diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..3d2ac0bd --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9450f45c..c03739d1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml -openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e -config_hash: 8c9a47f104c777e2a1e8f3fad15c093b +configured_endpoints: 118 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4f31d46f5ba187fc4d702c9f9f1573dacb891edbd086f935707578d7c4f5fed8.yml +openapi_spec_hash: 25b1019f20a47b8af665aae5f8fd0025 +config_hash: 5135e9237207028f293049a77428c775 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..d0d451f9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,34 @@ +# Changelog + +## 0.1.0 (2025-07-30) + +Full Changelog: [v0.0.1...v0.1.0](https://github.com/orbcorp/orb-csharp/compare/v0.0.1...v0.1.0) + +### Features + +* **api:** add C# ([e2db41d](https://github.com/orbcorp/orb-csharp/commit/e2db41d4c0585fc2e3472df2a88a5be4cb2432fb)) +* **api:** api update ([b08df82](https://github.com/orbcorp/orb-csharp/commit/b08df824c44e6cc0ac72d42b07c3c089f501862d)) +* **api:** api update ([d0d1a79](https://github.com/orbcorp/orb-csharp/commit/d0d1a7995095b23506e98a0ba0e5bdb47370dc5f)) +* **api:** api update ([268fdab](https://github.com/orbcorp/orb-csharp/commit/268fdab77f42a6e87ffc2f7fd1863bbd05d30033)) +* **api:** api update ([7c7a621](https://github.com/orbcorp/orb-csharp/commit/7c7a621be47edaca08972e0986c72dab410ec052)) +* **client:** automatically set constants for user ([25e678a](https://github.com/orbcorp/orb-csharp/commit/25e678a352492d8119389201e754ffa1b96b85a0)) +* **client:** implement implicit union casts ([5a6d432](https://github.com/orbcorp/orb-csharp/commit/5a6d4322fd6e82838a22f6658a6252f0c76bf367)) +* **client:** improve model names ([df035d1](https://github.com/orbcorp/orb-csharp/commit/df035d1ec73f8ce1226571a18732529a91eba08d)) +* **internal:** generate release flow files ([3eb9334](https://github.com/orbcorp/orb-csharp/commit/3eb9334def8a6d9e09154e9c3d606f42897379fa)) + + +### Bug Fixes + +* **internal:** prefer to use implicit instantiation when possible ([37366c3](https://github.com/orbcorp/orb-csharp/commit/37366c3e538f3923b5ecdcab2fc5118b348fc19a)) + + +### Chores + +* **docs:** clarify beta library limitations in readme ([f4d1b52](https://github.com/orbcorp/orb-csharp/commit/f4d1b5253cdf0e3576547ecf7e78dcdf89b36a00)) +* rename some things ([304c45c](https://github.com/orbcorp/orb-csharp/commit/304c45cc17894d6c769b3c8940b3eaf78016eebf)) +* use non-aliased `using` ([d670d93](https://github.com/orbcorp/orb-csharp/commit/d670d9359ae682140a6d2972bbde93a516fc27b8)) + + +### Documentation + +* note alpha status ([3167be0](https://github.com/orbcorp/orb-csharp/commit/3167be06e8e3929b18e0d4d6af09f69608e68515)) diff --git a/README.md b/README.md index 98a53c1d..231a0788 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # Orb C# API Library +> [!NOTE] +> The Orb C# API Library is currently in **beta** and we're excited for you to experiment with it! +> +> This library has not yet been exhaustively tested in production environments and may be missing some features you'd expect in a stable release. As we continue development, there may be breaking changes that require updates to your code. +> +> **We'd love your feedback!** Please share any suggestions, bug reports, feature requests, or general thoughts by [filing an issue](https://www.github.com/orbcorp/orb-csharp/issues/new). + The Orb C# SDK provides convenient access to the [Orb REST API](https://docs.withorb.com/reference/api-reference) from applications written in C#. The REST API documentation can be found on [docs.withorb.com](https://docs.withorb.com/reference/api-reference). @@ -17,21 +24,21 @@ dotnet add reference /path/to/orb-csharp/src/Orb/ See the [`examples`](examples) directory for complete and runnable examples. ```C# -using Customers = Orb.Models.Customers; -using Orb = Orb; -using System = System; +using Orb; +using Orb.Models.Customers; +using System; // Configured using the ORB_API_KEY, ORB_WEBHOOK_SECRET and ORB_BASE_URL environment variables -Orb::OrbClient client = new Orb::OrbClient(); +OrbClient client = new(); -var param = new Customers::CustomerCreateParams() +CustomerCreateParams param = new() { Email = "example-customer@withorb.com", Name = "My Customer" }; var customer = await client.Customers.Create(param); -System::Console.WriteLine(customer); +Console.WriteLine(customer); ``` ## Client Configuration @@ -39,18 +46,18 @@ System::Console.WriteLine(customer); Configure the client using environment variables: ```C# -using Orb = Orb; +using Orb; // Configured using the ORB_API_KEY, ORB_WEBHOOK_SECRET and ORB_BASE_URL environment variables -Orb::OrbClient client = new Orb::OrbClient(); +OrbClient client = new(); ``` Or manually: ```C# -using Orb = Orb; +using Orb; -Orb::OrbClient client = new Orb::OrbClient() +OrbClient client = new() { APIKey = "My API Key" }; diff --git a/examples/OrbExample/OrbExample.csproj b/examples/OrbExample/OrbExample.csproj index 215e7b03..b166ee76 100644 --- a/examples/OrbExample/OrbExample.csproj +++ b/examples/OrbExample/OrbExample.csproj @@ -1,11 +1,12 @@ - - - - - - Exe - net8.0 - OrbExample - enable - - + + + + + + Exe + net8.0 + OrbExample + enable + disable + + diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..a4ee7a8a --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "simple", + "extra-files": [ + "README.md" + ] +} \ No newline at end of file diff --git a/src/Orb.Tests/Orb.Tests.csproj b/src/Orb.Tests/Orb.Tests.csproj index 50524e44..891969c0 100644 --- a/src/Orb.Tests/Orb.Tests.csproj +++ b/src/Orb.Tests/Orb.Tests.csproj @@ -1,10 +1,9 @@ net8.0 - enable - enable false true + disable diff --git a/src/Orb.Tests/Service/Alerts/AlertServiceTest.cs b/src/Orb.Tests/Service/Alerts/AlertServiceTest.cs index f61c0e6c..c0c42ad8 100644 --- a/src/Orb.Tests/Service/Alerts/AlertServiceTest.cs +++ b/src/Orb.Tests/Service/Alerts/AlertServiceTest.cs @@ -1,47 +1,43 @@ +using System; +using System.Threading.Tasks; using AlertCreateForCustomerParamsProperties = Orb.Models.Alerts.AlertCreateForCustomerParamsProperties; using AlertCreateForExternalCustomerParamsProperties = Orb.Models.Alerts.AlertCreateForExternalCustomerParamsProperties; using AlertCreateForSubscriptionParamsProperties = Orb.Models.Alerts.AlertCreateForSubscriptionParamsProperties; -using Alerts = Orb.Models.Alerts; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; namespace Orb.Tests.Service.Alerts; -public class AlertServiceTest : Tests::TestBase +public class AlertServiceTest : TestBase { [Fact] - public async Tasks::Task Retrieve_Works() + public async Task Retrieve_Works() { - var alert = await this.client.Alerts.Retrieve( - new Alerts::AlertRetrieveParams() { AlertID = "alert_id" } - ); + var alert = await this.client.Alerts.Retrieve(new() { AlertID = "alert_id" }); alert.Validate(); } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var alert = await this.client.Alerts.Update( - new Alerts::AlertUpdateParams() + new() { AlertConfigurationID = "alert_configuration_id", - Thresholds = [new Alerts::Threshold() { Value = 0 }], + Thresholds = [new() { Value = 0 }], } ); alert.Validate(); } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Alerts.List( - new Alerts::AlertListParams() + new() { - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", CustomerID = "customer_id", ExternalCustomerID = "external_customer_id", @@ -53,43 +49,43 @@ public class AlertServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task CreateForCustomer_Works() + public async Task CreateForCustomer_Works() { var alert = await this.client.Alerts.CreateForCustomer( - new Alerts::AlertCreateForCustomerParams() + new() { CustomerID = "customer_id", Currency = "currency", Type = AlertCreateForCustomerParamsProperties::Type.CreditBalanceDepleted, - Thresholds = [new Alerts::Threshold() { Value = 0 }], + Thresholds = [new() { Value = 0 }], } ); alert.Validate(); } [Fact] - public async Tasks::Task CreateForExternalCustomer_Works() + public async Task CreateForExternalCustomer_Works() { var alert = await this.client.Alerts.CreateForExternalCustomer( - new Alerts::AlertCreateForExternalCustomerParams() + new() { ExternalCustomerID = "external_customer_id", Currency = "currency", Type = AlertCreateForExternalCustomerParamsProperties::Type.CreditBalanceDepleted, - Thresholds = [new Alerts::Threshold() { Value = 0 }], + Thresholds = [new() { Value = 0 }], } ); alert.Validate(); } [Fact] - public async Tasks::Task CreateForSubscription_Works() + public async Task CreateForSubscription_Works() { var alert = await this.client.Alerts.CreateForSubscription( - new Alerts::AlertCreateForSubscriptionParams() + new() { SubscriptionID = "subscription_id", - Thresholds = [new Alerts::Threshold() { Value = 0 }], + Thresholds = [new() { Value = 0 }], Type = AlertCreateForSubscriptionParamsProperties::Type.UsageExceeded, MetricID = "metric_id", } @@ -98,10 +94,10 @@ public class AlertServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Disable_Works() + public async Task Disable_Works() { var alert = await this.client.Alerts.Disable( - new Alerts::AlertDisableParams() + new() { AlertConfigurationID = "alert_configuration_id", SubscriptionID = "subscription_id", @@ -111,10 +107,10 @@ public class AlertServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Enable_Works() + public async Task Enable_Works() { var alert = await this.client.Alerts.Enable( - new Alerts::AlertEnableParams() + new() { AlertConfigurationID = "alert_configuration_id", SubscriptionID = "subscription_id", diff --git a/src/Orb.Tests/Service/Beta/BetaServiceTest.cs b/src/Orb.Tests/Service/Beta/BetaServiceTest.cs index 1cb8bc4a..75d29b74 100644 --- a/src/Orb.Tests/Service/Beta/BetaServiceTest.cs +++ b/src/Orb.Tests/Service/Beta/BetaServiceTest.cs @@ -1,260 +1,201 @@ -using AddAdjustmentProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddAdjustmentProperties; -using AddPriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties; -using Beta = Orb.Models.Beta; -using BetaCreatePlanVersionParamsProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -using CustomExpirationProperties = Orb.Models.CustomExpirationProperties; -using Models = Orb.Models; -using NewAllocationPriceProperties = Orb.Models.NewAllocationPriceProperties; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.CustomExpirationProperties; +using Orb.Models.NewAllocationPriceProperties; +using Orb.Models.NewPercentageDiscountProperties; +using Orb.Models.TransformPriceFilterProperties; +using Orb.Models.UnitConversionRateConfigProperties; using NewBillingCycleConfigurationProperties = Orb.Models.NewBillingCycleConfigurationProperties; -using NewPercentageDiscountProperties = Orb.Models.NewPercentageDiscountProperties; using NewPlanUnitPriceProperties = Orb.Models.NewPlanUnitPriceProperties; -using ReplaceAdjustmentProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; -using ReplacePriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using TransformPriceFilterProperties = Orb.Models.TransformPriceFilterProperties; -using UnitConversionRateConfigProperties = Orb.Models.UnitConversionRateConfigProperties; namespace Orb.Tests.Service.Beta; -public class BetaServiceTest : Tests::TestBase +public class BetaServiceTest : TestBase { [Fact] - public async Tasks::Task CreatePlanVersion_Works() + public async Task CreatePlanVersion_Works() { var planVersion = await this.client.Beta.CreatePlanVersion( - new Beta::BetaCreatePlanVersionParams() + new() { PlanID = "plan_id", Version = 0, AddAdjustments = [ - new BetaCreatePlanVersionParamsProperties::AddAdjustment() + new() { - Adjustment = AddAdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, PlanPhaseOrder = 0, }, ], AddPrices = [ - new BetaCreatePlanVersionParamsProperties::AddPrice() + new() { - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", - Cadence = NewAllocationPriceProperties::Cadence.Monthly, + Cadence = Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, PlanPhaseOrder = 0, - Price = AddPriceProperties::Price.Create( - new Models::NewPlanUnitPrice() + Price = new NewPlanUnitPrice() + { + Cadence = NewPlanUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewPlanUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewPlanUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewPlanUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewPlanUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), - }, - ], - RemoveAdjustments = - [ - new BetaCreatePlanVersionParamsProperties::RemoveAdjustment() - { - AdjustmentID = "adjustment_id", - PlanPhaseOrder = 0, - }, - ], - RemovePrices = - [ - new BetaCreatePlanVersionParamsProperties::RemovePrice() - { - PriceID = "price_id", - PlanPhaseOrder = 0, + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, }, ], + RemoveAdjustments = [new() { AdjustmentID = "adjustment_id", PlanPhaseOrder = 0 }], + RemovePrices = [new() { PriceID = "price_id", PlanPhaseOrder = 0 }], ReplaceAdjustments = [ - new BetaCreatePlanVersionParamsProperties::ReplaceAdjustment() + new() { - Adjustment = ReplaceAdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, ReplacesAdjustmentID = "replaces_adjustment_id", PlanPhaseOrder = 0, }, ], ReplacePrices = [ - new BetaCreatePlanVersionParamsProperties::ReplacePrice() + new() { ReplacesPriceID = "replaces_price_id", - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", - Cadence = NewAllocationPriceProperties::Cadence.Monthly, + Cadence = Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, PlanPhaseOrder = 0, - Price = ReplacePriceProperties::Price.Create( - new Models::NewPlanUnitPrice() + Price = new NewPlanUnitPrice() + { + Cadence = NewPlanUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewPlanUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewPlanUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewPlanUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewPlanUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, }, ], SetAsDefault = true, @@ -264,19 +205,19 @@ public class BetaServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task FetchPlanVersion_Works() + public async Task FetchPlanVersion_Works() { var planVersion = await this.client.Beta.FetchPlanVersion( - new Beta::BetaFetchPlanVersionParams() { PlanID = "plan_id", Version = "version" } + new() { PlanID = "plan_id", Version = "version" } ); planVersion.Validate(); } [Fact] - public async Tasks::Task SetDefaultPlanVersion_Works() + public async Task SetDefaultPlanVersion_Works() { var plan = await this.client.Beta.SetDefaultPlanVersion( - new Beta::BetaSetDefaultPlanVersionParams() { PlanID = "plan_id", Version = 0 } + new() { PlanID = "plan_id", Version = 0 } ); plan.Validate(); } diff --git a/src/Orb.Tests/Service/Beta/ExternalPlanID/ExternalPlanIDServiceTest.cs b/src/Orb.Tests/Service/Beta/ExternalPlanID/ExternalPlanIDServiceTest.cs index 8db84ab8..0f98410b 100644 --- a/src/Orb.Tests/Service/Beta/ExternalPlanID/ExternalPlanIDServiceTest.cs +++ b/src/Orb.Tests/Service/Beta/ExternalPlanID/ExternalPlanIDServiceTest.cs @@ -1,260 +1,201 @@ -using AddAdjustmentProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddAdjustmentProperties; -using AddPriceProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties; -using CustomExpirationProperties = Orb.Models.CustomExpirationProperties; -using ExternalPlanID = Orb.Models.Beta.ExternalPlanID; -using ExternalPlanIDCreatePlanVersionParamsProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -using Models = Orb.Models; -using NewAllocationPriceProperties = Orb.Models.NewAllocationPriceProperties; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.CustomExpirationProperties; +using Orb.Models.NewAllocationPriceProperties; +using Orb.Models.NewPercentageDiscountProperties; +using Orb.Models.TransformPriceFilterProperties; +using Orb.Models.UnitConversionRateConfigProperties; using NewBillingCycleConfigurationProperties = Orb.Models.NewBillingCycleConfigurationProperties; -using NewPercentageDiscountProperties = Orb.Models.NewPercentageDiscountProperties; using NewPlanUnitPriceProperties = Orb.Models.NewPlanUnitPriceProperties; -using ReplaceAdjustmentProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; -using ReplacePriceProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using TransformPriceFilterProperties = Orb.Models.TransformPriceFilterProperties; -using UnitConversionRateConfigProperties = Orb.Models.UnitConversionRateConfigProperties; namespace Orb.Tests.Service.Beta.ExternalPlanID; -public class ExternalPlanIDServiceTest : Tests::TestBase +public class ExternalPlanIDServiceTest : TestBase { [Fact] - public async Tasks::Task CreatePlanVersion_Works() + public async Task CreatePlanVersion_Works() { var planVersion = await this.client.Beta.ExternalPlanID.CreatePlanVersion( - new ExternalPlanID::ExternalPlanIDCreatePlanVersionParams() + new() { ExternalPlanID = "external_plan_id", Version = 0, AddAdjustments = [ - new ExternalPlanIDCreatePlanVersionParamsProperties::AddAdjustment() + new() { - Adjustment = AddAdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, PlanPhaseOrder = 0, }, ], AddPrices = [ - new ExternalPlanIDCreatePlanVersionParamsProperties::AddPrice() + new() { - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", - Cadence = NewAllocationPriceProperties::Cadence.Monthly, + Cadence = Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, PlanPhaseOrder = 0, - Price = AddPriceProperties::Price.Create( - new Models::NewPlanUnitPrice() + Price = new NewPlanUnitPrice() + { + Cadence = NewPlanUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewPlanUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewPlanUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewPlanUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewPlanUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), - }, - ], - RemoveAdjustments = - [ - new ExternalPlanIDCreatePlanVersionParamsProperties::RemoveAdjustment() - { - AdjustmentID = "adjustment_id", - PlanPhaseOrder = 0, - }, - ], - RemovePrices = - [ - new ExternalPlanIDCreatePlanVersionParamsProperties::RemovePrice() - { - PriceID = "price_id", - PlanPhaseOrder = 0, + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, }, ], + RemoveAdjustments = [new() { AdjustmentID = "adjustment_id", PlanPhaseOrder = 0 }], + RemovePrices = [new() { PriceID = "price_id", PlanPhaseOrder = 0 }], ReplaceAdjustments = [ - new ExternalPlanIDCreatePlanVersionParamsProperties::ReplaceAdjustment() + new() { - Adjustment = ReplaceAdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, ReplacesAdjustmentID = "replaces_adjustment_id", PlanPhaseOrder = 0, }, ], ReplacePrices = [ - new ExternalPlanIDCreatePlanVersionParamsProperties::ReplacePrice() + new() { ReplacesPriceID = "replaces_price_id", - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", - Cadence = NewAllocationPriceProperties::Cadence.Monthly, + Cadence = Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, PlanPhaseOrder = 0, - Price = ReplacePriceProperties::Price.Create( - new Models::NewPlanUnitPrice() + Price = new NewPlanUnitPrice() + { + Cadence = NewPlanUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewPlanUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewPlanUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewPlanUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewPlanUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, }, ], SetAsDefault = true, @@ -264,27 +205,19 @@ public class ExternalPlanIDServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task FetchPlanVersion_Works() + public async Task FetchPlanVersion_Works() { var planVersion = await this.client.Beta.ExternalPlanID.FetchPlanVersion( - new ExternalPlanID::ExternalPlanIDFetchPlanVersionParams() - { - ExternalPlanID = "external_plan_id", - Version = "version", - } + new() { ExternalPlanID = "external_plan_id", Version = "version" } ); planVersion.Validate(); } [Fact] - public async Tasks::Task SetDefaultPlanVersion_Works() + public async Task SetDefaultPlanVersion_Works() { var plan = await this.client.Beta.ExternalPlanID.SetDefaultPlanVersion( - new ExternalPlanID::ExternalPlanIDSetDefaultPlanVersionParams() - { - ExternalPlanID = "external_plan_id", - Version = 0, - } + new() { ExternalPlanID = "external_plan_id", Version = 0 } ); plan.Validate(); } diff --git a/src/Orb.Tests/Service/Coupons/CouponServiceTest.cs b/src/Orb.Tests/Service/Coupons/CouponServiceTest.cs index 3cd0d032..a18b8739 100644 --- a/src/Orb.Tests/Service/Coupons/CouponServiceTest.cs +++ b/src/Orb.Tests/Service/Coupons/CouponServiceTest.cs @@ -1,27 +1,17 @@ -using CouponCreateParamsProperties = Orb.Models.Coupons.CouponCreateParamsProperties; -using Coupons = Orb.Models.Coupons; -using DiscountProperties = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties; -using PercentageProperties = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties.PercentageProperties; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; +using Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties; namespace Orb.Tests.Service.Coupons; -public class CouponServiceTest : Tests::TestBase +public class CouponServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var coupon = await this.client.Coupons.Create( - new Coupons::CouponCreateParams() + new() { - Discount = CouponCreateParamsProperties::Discount.Create( - new DiscountProperties::Percentage() - { - DiscountType = PercentageProperties::DiscountType.Percentage, - PercentageDiscount = 0, - } - ), + Discount = new Percentage() { PercentageDiscount = 0 }, RedemptionCode = "HALFOFF", DurationInMonths = 12, MaxRedemptions = 1, @@ -31,10 +21,10 @@ public class CouponServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Coupons.List( - new Coupons::CouponListParams() + new() { Cursor = "cursor", Limit = 1, @@ -46,20 +36,16 @@ public class CouponServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Archive_Works() + public async Task Archive_Works() { - var coupon = await this.client.Coupons.Archive( - new Coupons::CouponArchiveParams() { CouponID = "coupon_id" } - ); + var coupon = await this.client.Coupons.Archive(new() { CouponID = "coupon_id" }); coupon.Validate(); } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var coupon = await this.client.Coupons.Fetch( - new Coupons::CouponFetchParams() { CouponID = "coupon_id" } - ); + var coupon = await this.client.Coupons.Fetch(new() { CouponID = "coupon_id" }); coupon.Validate(); } } diff --git a/src/Orb.Tests/Service/Coupons/Subscriptions/SubscriptionServiceTest.cs b/src/Orb.Tests/Service/Coupons/Subscriptions/SubscriptionServiceTest.cs index bbdbc07f..dc7e9c36 100644 --- a/src/Orb.Tests/Service/Coupons/Subscriptions/SubscriptionServiceTest.cs +++ b/src/Orb.Tests/Service/Coupons/Subscriptions/SubscriptionServiceTest.cs @@ -1,16 +1,14 @@ -using Subscriptions = Orb.Models.Coupons.Subscriptions; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.Coupons.Subscriptions; -public class SubscriptionServiceTest : Tests::TestBase +public class SubscriptionServiceTest : TestBase { [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Coupons.Subscriptions.List( - new Subscriptions::SubscriptionListParams() + new() { CouponID = "coupon_id", Cursor = "cursor", diff --git a/src/Orb.Tests/Service/CreditNotes/CreditNoteServiceTest.cs b/src/Orb.Tests/Service/CreditNotes/CreditNoteServiceTest.cs index c664efc3..daada1bc 100644 --- a/src/Orb.Tests/Service/CreditNotes/CreditNoteServiceTest.cs +++ b/src/Orb.Tests/Service/CreditNotes/CreditNoteServiceTest.cs @@ -1,48 +1,46 @@ -using CreditNoteCreateParamsProperties = Orb.Models.CreditNotes.CreditNoteCreateParamsProperties; -using CreditNotes = Orb.Models.CreditNotes; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System; +using System.Threading.Tasks; +using Orb.Models.CreditNotes.CreditNoteCreateParamsProperties; namespace Orb.Tests.Service.CreditNotes; -public class CreditNoteServiceTest : Tests::TestBase +public class CreditNoteServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var creditNote = await this.client.CreditNotes.Create( - new CreditNotes::CreditNoteCreateParams() + new() { LineItems = [ - new CreditNoteCreateParamsProperties::LineItem() + new() { Amount = "amount", InvoiceLineItemID = "4khy3nwzktxv7", - EndDate = System::DateOnly.Parse("2023-09-22"), - StartDate = System::DateOnly.Parse("2023-09-22"), + EndDate = DateOnly.Parse("2023-09-22"), + StartDate = DateOnly.Parse("2023-09-22"), }, ], - Reason = CreditNoteCreateParamsProperties::Reason.Duplicate, - EndDate = System::DateOnly.Parse("2023-09-22"), + Reason = Reason.Duplicate, + EndDate = DateOnly.Parse("2023-09-22"), Memo = "An optional memo for my credit note.", - StartDate = System::DateOnly.Parse("2023-09-22"), + StartDate = DateOnly.Parse("2023-09-22"), } ); creditNote.Validate(); } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.CreditNotes.List( - new CreditNotes::CreditNoteListParams() + new() { - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", Limit = 1, } @@ -51,10 +49,10 @@ public class CreditNoteServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { var creditNote = await this.client.CreditNotes.Fetch( - new CreditNotes::CreditNoteFetchParams() { CreditNoteID = "credit_note_id" } + new() { CreditNoteID = "credit_note_id" } ); creditNote.Validate(); } diff --git a/src/Orb.Tests/Service/Customers/BalanceTransactions/BalanceTransactionServiceTest.cs b/src/Orb.Tests/Service/Customers/BalanceTransactions/BalanceTransactionServiceTest.cs index dce54a80..5b2e5db0 100644 --- a/src/Orb.Tests/Service/Customers/BalanceTransactions/BalanceTransactionServiceTest.cs +++ b/src/Orb.Tests/Service/Customers/BalanceTransactions/BalanceTransactionServiceTest.cs @@ -1,18 +1,16 @@ +using System; +using System.Threading.Tasks; using BalanceTransactionCreateParamsProperties = Orb.Models.Customers.BalanceTransactions.BalanceTransactionCreateParamsProperties; -using BalanceTransactions = Orb.Models.Customers.BalanceTransactions; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; namespace Orb.Tests.Service.Customers.BalanceTransactions; -public class BalanceTransactionServiceTest : Tests::TestBase +public class BalanceTransactionServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var balanceTransaction = await this.client.Customers.BalanceTransactions.Create( - new BalanceTransactions::BalanceTransactionCreateParams() + new() { CustomerID = "customer_id", Amount = "amount", @@ -24,18 +22,18 @@ public class BalanceTransactionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Customers.BalanceTransactions.List( - new BalanceTransactions::BalanceTransactionListParams() + new() { CustomerID = "customer_id", Cursor = "cursor", Limit = 1, - OperationTimeGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - OperationTimeGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - OperationTimeLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - OperationTimeLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + OperationTimeGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + OperationTimeGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + OperationTimeLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + OperationTimeLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), } ); page.Validate(); diff --git a/src/Orb.Tests/Service/Customers/Costs/CostServiceTest.cs b/src/Orb.Tests/Service/Customers/Costs/CostServiceTest.cs index 3a93c5da..a0d2e493 100644 --- a/src/Orb.Tests/Service/Customers/Costs/CostServiceTest.cs +++ b/src/Orb.Tests/Service/Customers/Costs/CostServiceTest.cs @@ -1,40 +1,38 @@ +using System; +using System.Threading.Tasks; +using Orb.Models.Customers.Costs.CostListParamsProperties; using CostListByExternalIDParamsProperties = Orb.Models.Customers.Costs.CostListByExternalIDParamsProperties; -using CostListParamsProperties = Orb.Models.Customers.Costs.CostListParamsProperties; -using Costs = Orb.Models.Customers.Costs; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; namespace Orb.Tests.Service.Customers.Costs; -public class CostServiceTest : Tests::TestBase +public class CostServiceTest : TestBase { [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var costs = await this.client.Customers.Costs.List( - new Costs::CostListParams() + new() { CustomerID = "customer_id", Currency = "currency", - TimeframeEnd = System::DateTime.Parse("2022-03-01T05:00:00Z"), - TimeframeStart = System::DateTime.Parse("2022-02-01T05:00:00Z"), - ViewMode = CostListParamsProperties::ViewMode.Periodic, + TimeframeEnd = DateTime.Parse("2022-03-01T05:00:00Z"), + TimeframeStart = DateTime.Parse("2022-02-01T05:00:00Z"), + ViewMode = ViewMode.Periodic, } ); costs.Validate(); } [Fact] - public async Tasks::Task ListByExternalID_Works() + public async Task ListByExternalID_Works() { var response = await this.client.Customers.Costs.ListByExternalID( - new Costs::CostListByExternalIDParams() + new() { ExternalCustomerID = "external_customer_id", Currency = "currency", - TimeframeEnd = System::DateTime.Parse("2022-03-01T05:00:00Z"), - TimeframeStart = System::DateTime.Parse("2022-02-01T05:00:00Z"), + TimeframeEnd = DateTime.Parse("2022-03-01T05:00:00Z"), + TimeframeStart = DateTime.Parse("2022-02-01T05:00:00Z"), ViewMode = CostListByExternalIDParamsProperties::ViewMode.Periodic, } ); diff --git a/src/Orb.Tests/Service/Customers/Credits/CreditServiceTest.cs b/src/Orb.Tests/Service/Customers/Credits/CreditServiceTest.cs index 9acd43d4..ccf2b984 100644 --- a/src/Orb.Tests/Service/Customers/Credits/CreditServiceTest.cs +++ b/src/Orb.Tests/Service/Customers/Credits/CreditServiceTest.cs @@ -1,16 +1,14 @@ -using Credits = Orb.Models.Customers.Credits; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.Customers.Credits; -public class CreditServiceTest : Tests::TestBase +public class CreditServiceTest : TestBase { [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Customers.Credits.List( - new Credits::CreditListParams() + new() { CustomerID = "customer_id", Currency = "currency", @@ -23,10 +21,10 @@ public class CreditServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task ListByExternalID_Works() + public async Task ListByExternalID_Works() { var page = await this.client.Customers.Credits.ListByExternalID( - new Credits::CreditListByExternalIDParams() + new() { ExternalCustomerID = "external_customer_id", Currency = "currency", diff --git a/src/Orb.Tests/Service/Customers/Credits/Ledger/LedgerServiceTest.cs b/src/Orb.Tests/Service/Customers/Credits/Ledger/LedgerServiceTest.cs index 3d01de1c..ee1a572b 100644 --- a/src/Orb.Tests/Service/Customers/Credits/Ledger/LedgerServiceTest.cs +++ b/src/Orb.Tests/Service/Customers/Credits/Ledger/LedgerServiceTest.cs @@ -1,37 +1,29 @@ -using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -using BodyProperties1 = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -using IncrementProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties; -using IncrementProperties1 = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties; -using InvoiceSettingsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; -using InvoiceSettingsProperties1 = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; -using Ledger = Orb.Models.Customers.Credits.Ledger; -using LedgerCreateEntryByExternalIDParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties; -using LedgerCreateEntryParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties; +using System; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; +using Orb.Models.Customers.Credits.Ledger.LedgerListParamsProperties; +using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; using LedgerListByExternalIDParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDParamsProperties; -using LedgerListParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerListParamsProperties; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; namespace Orb.Tests.Service.Customers.Credits.Ledger; -public class LedgerServiceTest : Tests::TestBase +public class LedgerServiceTest : TestBase { [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Customers.Credits.Ledger.List( - new Ledger::LedgerListParams() + new() { CustomerID = "customer_id", - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Currency = "currency", Cursor = "cursor", - EntryStatus = LedgerListParamsProperties::EntryStatus.Committed, - EntryType = LedgerListParamsProperties::EntryType.Increment, + EntryStatus = EntryStatus.Committed, + EntryType = EntryType.Increment, Limit = 1, MinimumAmount = "minimum_amount", } @@ -40,86 +32,76 @@ public class LedgerServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task CreateEntry_Works() + public async Task CreateEntry_Works() { var response = await this.client.Customers.Credits.Ledger.CreateEntry( - new Ledger::LedgerCreateEntryParams() + new() { CustomerID = "customer_id", - Body = LedgerCreateEntryParamsProperties::Body.Create( - new BodyProperties::Increment() + Body = new Increment() + { + Amount = 0, + Currency = "currency", + Description = "description", + EffectiveDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + ExpiryDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceSettings = new() { - Amount = 0, - EntryType = IncrementProperties::EntryType.Increment, - Currency = "currency", - Description = "description", - EffectiveDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - ExpiryDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - InvoiceSettings = new IncrementProperties::InvoiceSettings() - { - AutoCollection = true, - NetTerms = 0, - InvoiceDate = InvoiceSettingsProperties::InvoiceDate.Create( - System::DateOnly.Parse("2019-12-27") - ), - Memo = "memo", - RequireSuccessfulPayment = true, - }, - Metadata = new() { { "foo", "string" } }, - PerUnitCostBasis = "per_unit_cost_basis", - } - ), + AutoCollection = true, + NetTerms = 0, + InvoiceDate = DateOnly.Parse("2019-12-27"), + Memo = "memo", + RequireSuccessfulPayment = true, + }, + Metadata = new() { { "foo", "string" } }, + PerUnitCostBasis = "per_unit_cost_basis", + }, } ); response.Validate(); } [Fact] - public async Tasks::Task CreateEntryByExternalID_Works() + public async Task CreateEntryByExternalID_Works() { var response = await this.client.Customers.Credits.Ledger.CreateEntryByExternalID( - new Ledger::LedgerCreateEntryByExternalIDParams() + new() { ExternalCustomerID = "external_customer_id", - Body = LedgerCreateEntryByExternalIDParamsProperties::Body.Create( - new BodyProperties1::Increment() + Body = new BodyProperties::Increment() + { + Amount = 0, + Currency = "currency", + Description = "description", + EffectiveDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + ExpiryDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceSettings = new() { - Amount = 0, - EntryType = IncrementProperties1::EntryType.Increment, - Currency = "currency", - Description = "description", - EffectiveDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - ExpiryDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - InvoiceSettings = new IncrementProperties1::InvoiceSettings() - { - AutoCollection = true, - NetTerms = 0, - InvoiceDate = InvoiceSettingsProperties1::InvoiceDate.Create( - System::DateOnly.Parse("2019-12-27") - ), - Memo = "memo", - RequireSuccessfulPayment = true, - }, - Metadata = new() { { "foo", "string" } }, - PerUnitCostBasis = "per_unit_cost_basis", - } - ), + AutoCollection = true, + NetTerms = 0, + InvoiceDate = DateOnly.Parse("2019-12-27"), + Memo = "memo", + RequireSuccessfulPayment = true, + }, + Metadata = new() { { "foo", "string" } }, + PerUnitCostBasis = "per_unit_cost_basis", + }, } ); response.Validate(); } [Fact] - public async Tasks::Task ListByExternalID_Works() + public async Task ListByExternalID_Works() { var page = await this.client.Customers.Credits.Ledger.ListByExternalID( - new Ledger::LedgerListByExternalIDParams() + new() { ExternalCustomerID = "external_customer_id", - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Currency = "currency", Cursor = "cursor", EntryStatus = LedgerListByExternalIDParamsProperties::EntryStatus.Committed, diff --git a/src/Orb.Tests/Service/Customers/Credits/TopUps/TopUpServiceTest.cs b/src/Orb.Tests/Service/Customers/Credits/TopUps/TopUpServiceTest.cs index 2879cb61..70cfbf0d 100644 --- a/src/Orb.Tests/Service/Customers/Credits/TopUps/TopUpServiceTest.cs +++ b/src/Orb.Tests/Service/Customers/Credits/TopUps/TopUpServiceTest.cs @@ -1,24 +1,22 @@ -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits.TopUps.TopUpCreateParamsProperties; using TopUpCreateByExternalIDParamsProperties = Orb.Models.Customers.Credits.TopUps.TopUpCreateByExternalIDParamsProperties; -using TopUpCreateParamsProperties = Orb.Models.Customers.Credits.TopUps.TopUpCreateParamsProperties; -using TopUps = Orb.Models.Customers.Credits.TopUps; namespace Orb.Tests.Service.Customers.Credits.TopUps; -public class TopUpServiceTest : Tests::TestBase +public class TopUpServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var topUp = await this.client.Customers.Credits.TopUps.Create( - new TopUps::TopUpCreateParams() + new() { CustomerID = "customer_id", Amount = "amount", Currency = "currency", - InvoiceSettings = new TopUpCreateParamsProperties::InvoiceSettings() + InvoiceSettings = new() { AutoCollection = true, NetTerms = 0, @@ -27,19 +25,19 @@ public class TopUpServiceTest : Tests::TestBase }, PerUnitCostBasis = "per_unit_cost_basis", Threshold = "threshold", - ActiveFrom = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + ActiveFrom = DateTime.Parse("2019-12-27T18:11:19.117Z"), ExpiresAfter = 0, - ExpiresAfterUnit = TopUpCreateParamsProperties::ExpiresAfterUnit.Day, + ExpiresAfterUnit = ExpiresAfterUnit.Day, } ); topUp.Validate(); } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Customers.Credits.TopUps.List( - new TopUps::TopUpListParams() + new() { CustomerID = "customer_id", Cursor = "cursor", @@ -50,23 +48,23 @@ public class TopUpServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Delete_Works() + public async Task Delete_Works() { await this.client.Customers.Credits.TopUps.Delete( - new TopUps::TopUpDeleteParams() { CustomerID = "customer_id", TopUpID = "top_up_id" } + new() { CustomerID = "customer_id", TopUpID = "top_up_id" } ); } [Fact] - public async Tasks::Task CreateByExternalID_Works() + public async Task CreateByExternalID_Works() { var response = await this.client.Customers.Credits.TopUps.CreateByExternalID( - new TopUps::TopUpCreateByExternalIDParams() + new() { ExternalCustomerID = "external_customer_id", Amount = "amount", Currency = "currency", - InvoiceSettings = new TopUpCreateByExternalIDParamsProperties::InvoiceSettings() + InvoiceSettings = new() { AutoCollection = true, NetTerms = 0, @@ -75,7 +73,7 @@ await this.client.Customers.Credits.TopUps.Delete( }, PerUnitCostBasis = "per_unit_cost_basis", Threshold = "threshold", - ActiveFrom = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + ActiveFrom = DateTime.Parse("2019-12-27T18:11:19.117Z"), ExpiresAfter = 0, ExpiresAfterUnit = TopUpCreateByExternalIDParamsProperties::ExpiresAfterUnit.Day, } @@ -84,22 +82,18 @@ await this.client.Customers.Credits.TopUps.Delete( } [Fact] - public async Tasks::Task DeleteByExternalID_Works() + public async Task DeleteByExternalID_Works() { await this.client.Customers.Credits.TopUps.DeleteByExternalID( - new TopUps::TopUpDeleteByExternalIDParams() - { - ExternalCustomerID = "external_customer_id", - TopUpID = "top_up_id", - } + new() { ExternalCustomerID = "external_customer_id", TopUpID = "top_up_id" } ); } [Fact] - public async Tasks::Task ListByExternalID_Works() + public async Task ListByExternalID_Works() { var page = await this.client.Customers.Credits.TopUps.ListByExternalID( - new TopUps::TopUpListByExternalIDParams() + new() { ExternalCustomerID = "external_customer_id", Cursor = "cursor", diff --git a/src/Orb.Tests/Service/Customers/CustomerServiceTest.cs b/src/Orb.Tests/Service/Customers/CustomerServiceTest.cs index 96dbc5fe..c93cb86c 100644 --- a/src/Orb.Tests/Service/Customers/CustomerServiceTest.cs +++ b/src/Orb.Tests/Service/Customers/CustomerServiceTest.cs @@ -1,31 +1,29 @@ -using CustomerCreateParamsProperties = Orb.Models.Customers.CustomerCreateParamsProperties; -using Customers = Orb.Models.Customers; +using System; +using System.Threading.Tasks; +using Orb.Models.Customers; +using Orb.Models.Customers.CustomerCreateParamsProperties; +using Orb.Models.Customers.NewAvalaraTaxConfigurationProperties; using CustomerTaxIDProperties = Orb.Models.CustomerTaxIDProperties; using CustomerUpdateByExternalIDParamsProperties = Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties; using CustomerUpdateParamsProperties = Orb.Models.Customers.CustomerUpdateParamsProperties; -using Models = Orb.Models; -using NewAvalaraTaxConfigurationProperties = Orb.Models.Customers.NewAvalaraTaxConfigurationProperties; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; namespace Orb.Tests.Service.Customers; -public class CustomerServiceTest : Tests::TestBase +public class CustomerServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var customer = await this.client.Customers.Create( - new Customers::CustomerCreateParams() + new() { Email = "dev@stainless.com", Name = "x", - AccountingSyncConfiguration = new Customers::NewAccountingSyncConfiguration() + AccountingSyncConfiguration = new() { AccountingProviders = [ - new Customers::AccountingProviderConfig() + new() { ExternalProviderID = "external_provider_id", ProviderType = "provider_type", @@ -35,7 +33,7 @@ public class CustomerServiceTest : Tests::TestBase }, AdditionalEmails = ["dev@stainless.com"], AutoCollection = true, - BillingAddress = new Customers::AddressInput() + BillingAddress = new() { City = "city", Country = "country", @@ -47,19 +45,16 @@ public class CustomerServiceTest : Tests::TestBase Currency = "currency", EmailDelivery = true, ExternalCustomerID = "external_customer_id", - Hierarchy = new Customers::CustomerHierarchyConfig() + Hierarchy = new() { ChildCustomerIDs = ["string"], ParentCustomerID = "parent_customer_id", }, Metadata = new() { { "foo", "string" } }, - PaymentProvider = CustomerCreateParamsProperties::PaymentProvider.Quickbooks, + PaymentProvider = PaymentProvider.Quickbooks, PaymentProviderID = "payment_provider_id", - ReportingConfiguration = new Customers::NewReportingConfiguration() - { - Exempt = true, - }, - ShippingAddress = new Customers::AddressInput() + ReportingConfiguration = new() { Exempt = true }, + ShippingAddress = new() { City = "city", Country = "country", @@ -68,15 +63,13 @@ public class CustomerServiceTest : Tests::TestBase PostalCode = "postal_code", State = "state", }, - TaxConfiguration = CustomerCreateParamsProperties::TaxConfiguration.Create( - new Customers::NewAvalaraTaxConfiguration() - { - TaxExempt = true, - TaxProvider = NewAvalaraTaxConfigurationProperties::TaxProvider.Avalara, - TaxExemptionCode = "tax_exemption_code", - } - ), - TaxID = new Models::CustomerTaxID() + TaxConfiguration = new NewAvalaraTaxConfiguration() + { + TaxExempt = true, + TaxProvider = TaxProvider.Avalara, + TaxExemptionCode = "tax_exemption_code", + }, + TaxID = new() { Country = CustomerTaxIDProperties::Country.Ad, Type = CustomerTaxIDProperties::Type.AdNrt, @@ -89,17 +82,17 @@ public class CustomerServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var customer = await this.client.Customers.Update( - new Customers::CustomerUpdateParams() + new() { CustomerID = "customer_id", - AccountingSyncConfiguration = new Customers::NewAccountingSyncConfiguration() + AccountingSyncConfiguration = new() { AccountingProviders = [ - new Customers::AccountingProviderConfig() + new() { ExternalProviderID = "external_provider_id", ProviderType = "provider_type", @@ -109,7 +102,7 @@ public class CustomerServiceTest : Tests::TestBase }, AdditionalEmails = ["string"], AutoCollection = true, - BillingAddress = new Customers::AddressInput() + BillingAddress = new() { City = "city", Country = "country", @@ -122,7 +115,7 @@ public class CustomerServiceTest : Tests::TestBase Email = "dev@stainless.com", EmailDelivery = true, ExternalCustomerID = "external_customer_id", - Hierarchy = new Customers::CustomerHierarchyConfig() + Hierarchy = new() { ChildCustomerIDs = ["string"], ParentCustomerID = "parent_customer_id", @@ -131,11 +124,8 @@ public class CustomerServiceTest : Tests::TestBase Name = "name", PaymentProvider = CustomerUpdateParamsProperties::PaymentProvider.Quickbooks, PaymentProviderID = "payment_provider_id", - ReportingConfiguration = new Customers::NewReportingConfiguration() - { - Exempt = true, - }, - ShippingAddress = new Customers::AddressInput() + ReportingConfiguration = new() { Exempt = true }, + ShippingAddress = new() { City = "city", Country = "country", @@ -144,15 +134,13 @@ public class CustomerServiceTest : Tests::TestBase PostalCode = "postal_code", State = "state", }, - TaxConfiguration = CustomerUpdateParamsProperties::TaxConfiguration.Create( - new Customers::NewAvalaraTaxConfiguration() - { - TaxExempt = true, - TaxProvider = NewAvalaraTaxConfigurationProperties::TaxProvider.Avalara, - TaxExemptionCode = "tax_exemption_code", - } - ), - TaxID = new Models::CustomerTaxID() + TaxConfiguration = new NewAvalaraTaxConfiguration() + { + TaxExempt = true, + TaxProvider = TaxProvider.Avalara, + TaxExemptionCode = "tax_exemption_code", + }, + TaxID = new() { Country = CustomerTaxIDProperties::Country.Ad, Type = CustomerTaxIDProperties::Type.AdNrt, @@ -164,15 +152,15 @@ public class CustomerServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Customers.List( - new Customers::CustomerListParams() + new() { - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", Limit = 1, } @@ -181,68 +169,55 @@ public class CustomerServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Delete_Works() + public async Task Delete_Works() { - await this.client.Customers.Delete( - new Customers::CustomerDeleteParams() { CustomerID = "customer_id" } - ); + await this.client.Customers.Delete(new() { CustomerID = "customer_id" }); } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var customer = await this.client.Customers.Fetch( - new Customers::CustomerFetchParams() { CustomerID = "customer_id" } - ); + var customer = await this.client.Customers.Fetch(new() { CustomerID = "customer_id" }); customer.Validate(); } [Fact] - public async Tasks::Task FetchByExternalID_Works() + public async Task FetchByExternalID_Works() { var customer = await this.client.Customers.FetchByExternalID( - new Customers::CustomerFetchByExternalIDParams() - { - ExternalCustomerID = "external_customer_id", - } + new() { ExternalCustomerID = "external_customer_id" } ); customer.Validate(); } [Fact] - public async Tasks::Task SyncPaymentMethodsFromGateway_Works() + public async Task SyncPaymentMethodsFromGateway_Works() { await this.client.Customers.SyncPaymentMethodsFromGateway( - new Customers::CustomerSyncPaymentMethodsFromGatewayParams() - { - CustomerID = "customer_id", - } + new() { CustomerID = "customer_id" } ); } [Fact] - public async Tasks::Task SyncPaymentMethodsFromGatewayByExternalCustomerID_Works() + public async Task SyncPaymentMethodsFromGatewayByExternalCustomerID_Works() { await this.client.Customers.SyncPaymentMethodsFromGatewayByExternalCustomerID( - new Customers::CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams() - { - ExternalCustomerID = "external_customer_id", - } + new() { ExternalCustomerID = "external_customer_id" } ); } [Fact] - public async Tasks::Task UpdateByExternalID_Works() + public async Task UpdateByExternalID_Works() { var customer = await this.client.Customers.UpdateByExternalID( - new Customers::CustomerUpdateByExternalIDParams() + new() { ID = "external_customer_id", - AccountingSyncConfiguration = new Customers::NewAccountingSyncConfiguration() + AccountingSyncConfiguration = new() { AccountingProviders = [ - new Customers::AccountingProviderConfig() + new() { ExternalProviderID = "external_provider_id", ProviderType = "provider_type", @@ -252,7 +227,7 @@ await this.client.Customers.SyncPaymentMethodsFromGatewayByExternalCustomerID( }, AdditionalEmails = ["string"], AutoCollection = true, - BillingAddress = new Customers::AddressInput() + BillingAddress = new() { City = "city", Country = "country", @@ -265,7 +240,7 @@ await this.client.Customers.SyncPaymentMethodsFromGatewayByExternalCustomerID( Email = "dev@stainless.com", EmailDelivery = true, ExternalCustomerID = "external_customer_id", - Hierarchy = new Customers::CustomerHierarchyConfig() + Hierarchy = new() { ChildCustomerIDs = ["string"], ParentCustomerID = "parent_customer_id", @@ -275,11 +250,8 @@ await this.client.Customers.SyncPaymentMethodsFromGatewayByExternalCustomerID( PaymentProvider = CustomerUpdateByExternalIDParamsProperties::PaymentProvider.Quickbooks, PaymentProviderID = "payment_provider_id", - ReportingConfiguration = new Customers::NewReportingConfiguration() - { - Exempt = true, - }, - ShippingAddress = new Customers::AddressInput() + ReportingConfiguration = new() { Exempt = true }, + ShippingAddress = new() { City = "city", Country = "country", @@ -288,16 +260,13 @@ await this.client.Customers.SyncPaymentMethodsFromGatewayByExternalCustomerID( PostalCode = "postal_code", State = "state", }, - TaxConfiguration = - CustomerUpdateByExternalIDParamsProperties::TaxConfiguration.Create( - new Customers::NewAvalaraTaxConfiguration() - { - TaxExempt = true, - TaxProvider = NewAvalaraTaxConfigurationProperties::TaxProvider.Avalara, - TaxExemptionCode = "tax_exemption_code", - } - ), - TaxID = new Models::CustomerTaxID() + TaxConfiguration = new NewAvalaraTaxConfiguration() + { + TaxExempt = true, + TaxProvider = TaxProvider.Avalara, + TaxExemptionCode = "tax_exemption_code", + }, + TaxID = new() { Country = CustomerTaxIDProperties::Country.Ad, Type = CustomerTaxIDProperties::Type.AdNrt, diff --git a/src/Orb.Tests/Service/DimensionalPriceGroups/DimensionalPriceGroupServiceTest.cs b/src/Orb.Tests/Service/DimensionalPriceGroups/DimensionalPriceGroupServiceTest.cs index 64882f8f..96924445 100644 --- a/src/Orb.Tests/Service/DimensionalPriceGroups/DimensionalPriceGroupServiceTest.cs +++ b/src/Orb.Tests/Service/DimensionalPriceGroups/DimensionalPriceGroupServiceTest.cs @@ -1,16 +1,14 @@ -using DimensionalPriceGroups = Orb.Models.DimensionalPriceGroups; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.DimensionalPriceGroups; -public class DimensionalPriceGroupServiceTest : Tests::TestBase +public class DimensionalPriceGroupServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var dimensionalPriceGroup = await this.client.DimensionalPriceGroups.Create( - new DimensionalPriceGroups::DimensionalPriceGroupCreateParams() + new() { BillableMetricID = "billable_metric_id", Dimensions = ["region", "instance_type"], @@ -23,26 +21,33 @@ public class DimensionalPriceGroupServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Retrieve_Works() + public async Task Retrieve_Works() { var dimensionalPriceGroup = await this.client.DimensionalPriceGroups.Retrieve( - new DimensionalPriceGroups::DimensionalPriceGroupRetrieveParams() + new() { DimensionalPriceGroupID = "dimensional_price_group_id" } + ); + dimensionalPriceGroup.Validate(); + } + + [Fact] + public async Task Update_Works() + { + var dimensionalPriceGroup = await this.client.DimensionalPriceGroups.Update( + new() { DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = "external_dimensional_price_group_id", + Metadata = new() { { "foo", "string" } }, } ); dimensionalPriceGroup.Validate(); } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.DimensionalPriceGroups.List( - new DimensionalPriceGroups::DimensionalPriceGroupListParams() - { - Cursor = "cursor", - Limit = 1, - } + new() { Cursor = "cursor", Limit = 1 } ); page.Validate(); } diff --git a/src/Orb.Tests/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDServiceTest.cs b/src/Orb.Tests/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDServiceTest.cs index 204fb06e..ceb80ace 100644 --- a/src/Orb.Tests/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDServiceTest.cs +++ b/src/Orb.Tests/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDServiceTest.cs @@ -1,19 +1,29 @@ -using ExternalDimensionalPriceGroupID = Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; -public class ExternalDimensionalPriceGroupIDServiceTest : Tests::TestBase +public class ExternalDimensionalPriceGroupIDServiceTest : TestBase { [Fact] - public async Tasks::Task Retrieve_Works() + public async Task Retrieve_Works() { var dimensionalPriceGroup = await this.client.DimensionalPriceGroups.ExternalDimensionalPriceGroupID.Retrieve( - new ExternalDimensionalPriceGroupID::ExternalDimensionalPriceGroupIDRetrieveParams() + new() { ExternalDimensionalPriceGroupID = "external_dimensional_price_group_id" } + ); + dimensionalPriceGroup.Validate(); + } + + [Fact] + public async Task Update_Works() + { + var dimensionalPriceGroup = + await this.client.DimensionalPriceGroups.ExternalDimensionalPriceGroupID.Update( + new() { ExternalDimensionalPriceGroupID = "external_dimensional_price_group_id", + ExternalDimensionalPriceGroupID1 = "external_dimensional_price_group_id", + Metadata = new() { { "foo", "string" } }, } ); dimensionalPriceGroup.Validate(); diff --git a/src/Orb.Tests/Service/Events/Backfills/BackfillServiceTest.cs b/src/Orb.Tests/Service/Events/Backfills/BackfillServiceTest.cs index 4f98d59e..fe3cefed 100644 --- a/src/Orb.Tests/Service/Events/Backfills/BackfillServiceTest.cs +++ b/src/Orb.Tests/Service/Events/Backfills/BackfillServiceTest.cs @@ -1,21 +1,19 @@ -using Backfills = Orb.Models.Events.Backfills; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System; +using System.Threading.Tasks; namespace Orb.Tests.Service.Events.Backfills; -public class BackfillServiceTest : Tests::TestBase +public class BackfillServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var backfill = await this.client.Events.Backfills.Create( - new Backfills::BackfillCreateParams() + new() { - TimeframeEnd = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - TimeframeStart = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CloseTime = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeEnd = DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeStart = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CloseTime = DateTime.Parse("2019-12-27T18:11:19.117Z"), CustomerID = "customer_id", DeprecationFilter = "my_numeric_property > 100 AND my_other_property = 'bar'", ExternalCustomerID = "external_customer_id", @@ -26,37 +24,35 @@ public class BackfillServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { - var page = await this.client.Events.Backfills.List( - new Backfills::BackfillListParams() { Cursor = "cursor", Limit = 1 } - ); + var page = await this.client.Events.Backfills.List(new() { Cursor = "cursor", Limit = 1 }); page.Validate(); } [Fact] - public async Tasks::Task Close_Works() + public async Task Close_Works() { var response = await this.client.Events.Backfills.Close( - new Backfills::BackfillCloseParams() { BackfillID = "backfill_id" } + new() { BackfillID = "backfill_id" } ); response.Validate(); } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { var response = await this.client.Events.Backfills.Fetch( - new Backfills::BackfillFetchParams() { BackfillID = "backfill_id" } + new() { BackfillID = "backfill_id" } ); response.Validate(); } [Fact] - public async Tasks::Task Revert_Works() + public async Task Revert_Works() { var response = await this.client.Events.Backfills.Revert( - new Backfills::BackfillRevertParams() { BackfillID = "backfill_id" } + new() { BackfillID = "backfill_id" } ); response.Validate(); } diff --git a/src/Orb.Tests/Service/Events/EventServiceTest.cs b/src/Orb.Tests/Service/Events/EventServiceTest.cs index 588c0abe..1514ebd9 100644 --- a/src/Orb.Tests/Service/Events/EventServiceTest.cs +++ b/src/Orb.Tests/Service/Events/EventServiceTest.cs @@ -1,24 +1,21 @@ -using EventIngestParamsProperties = Orb.Models.Events.EventIngestParamsProperties; -using Events = Orb.Models.Events; -using Json = System.Text.Json; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System; +using System.Text.Json; +using System.Threading.Tasks; namespace Orb.Tests.Service.Events; -public class EventServiceTest : Tests::TestBase +public class EventServiceTest : TestBase { [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var event1 = await this.client.Events.Update( - new Events::EventUpdateParams() + new() { EventID = "event_id", EventName = "event_name", - Properties = new() { { "foo", Json::JsonSerializer.SerializeToElement("bar") } }, - Timestamp = System::DateTime.Parse("2020-12-09T16:09:53Z"), + Properties = new() { { "foo", JsonSerializer.SerializeToElement("bar") } }, + Timestamp = DateTime.Parse("2020-12-09T16:09:53Z"), CustomerID = "customer_id", ExternalCustomerID = "external_customer_id", } @@ -27,31 +24,26 @@ public class EventServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Deprecate_Works() + public async Task Deprecate_Works() { - var response = await this.client.Events.Deprecate( - new Events::EventDeprecateParams() { EventID = "event_id" } - ); + var response = await this.client.Events.Deprecate(new() { EventID = "event_id" }); response.Validate(); } [Fact] - public async Tasks::Task Ingest_Works() + public async Task Ingest_Works() { var response = await this.client.Events.Ingest( - new Events::EventIngestParams() + new() { Events = [ - new EventIngestParamsProperties::Event() + new() { EventName = "event_name", IdempotencyKey = "idempotency_key", - Properties1 = new() - { - { "foo", Json::JsonSerializer.SerializeToElement("bar") }, - }, - Timestamp = System::DateTime.Parse("2020-12-09T16:09:53Z"), + Properties1 = new() { { "foo", JsonSerializer.SerializeToElement("bar") } }, + Timestamp = DateTime.Parse("2020-12-09T16:09:53Z"), CustomerID = "customer_id", ExternalCustomerID = "external_customer_id", }, @@ -64,14 +56,14 @@ public class EventServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Search_Works() + public async Task Search_Works() { var response = await this.client.Events.Search( - new Events::EventSearchParams() + new() { EventIDs = ["string"], - TimeframeEnd = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - TimeframeStart = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeEnd = DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeStart = DateTime.Parse("2019-12-27T18:11:19.117Z"), } ); response.Validate(); diff --git a/src/Orb.Tests/Service/Events/Volume/VolumeServiceTest.cs b/src/Orb.Tests/Service/Events/Volume/VolumeServiceTest.cs index 39f034e5..fc201011 100644 --- a/src/Orb.Tests/Service/Events/Volume/VolumeServiceTest.cs +++ b/src/Orb.Tests/Service/Events/Volume/VolumeServiceTest.cs @@ -1,22 +1,20 @@ -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using Volume = Orb.Models.Events.Volume; +using System; +using System.Threading.Tasks; namespace Orb.Tests.Service.Events.Volume; -public class VolumeServiceTest : Tests::TestBase +public class VolumeServiceTest : TestBase { [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var eventVolumes = await this.client.Events.Volume.List( - new Volume::VolumeListParams() + new() { - TimeframeStart = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeStart = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", Limit = 1, - TimeframeEnd = System::DateTime.Parse("2024-10-11T06:00:00Z"), + TimeframeEnd = DateTime.Parse("2024-10-11T06:00:00Z"), } ); eventVolumes.Validate(); diff --git a/src/Orb.Tests/Service/InvoiceLineItems/InvoiceLineItemServiceTest.cs b/src/Orb.Tests/Service/InvoiceLineItems/InvoiceLineItemServiceTest.cs index 4f1453ec..987b8d77 100644 --- a/src/Orb.Tests/Service/InvoiceLineItems/InvoiceLineItemServiceTest.cs +++ b/src/Orb.Tests/Service/InvoiceLineItems/InvoiceLineItemServiceTest.cs @@ -1,24 +1,22 @@ -using InvoiceLineItems = Orb.Models.InvoiceLineItems; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System; +using System.Threading.Tasks; namespace Orb.Tests.Service.InvoiceLineItems; -public class InvoiceLineItemServiceTest : Tests::TestBase +public class InvoiceLineItemServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var invoiceLineItem = await this.client.InvoiceLineItems.Create( - new InvoiceLineItems::InvoiceLineItemCreateParams() + new() { Amount = "12.00", - EndDate = System::DateOnly.Parse("2023-09-22"), + EndDate = DateOnly.Parse("2023-09-22"), InvoiceID = "4khy3nwzktxv7", Name = "Item Name", Quantity = 1, - StartDate = System::DateOnly.Parse("2023-09-22"), + StartDate = DateOnly.Parse("2023-09-22"), } ); invoiceLineItem.Validate(); diff --git a/src/Orb.Tests/Service/Invoices/InvoiceServiceTest.cs b/src/Orb.Tests/Service/Invoices/InvoiceServiceTest.cs index 39d6aed2..463132ac 100644 --- a/src/Orb.Tests/Service/Invoices/InvoiceServiceTest.cs +++ b/src/Orb.Tests/Service/Invoices/InvoiceServiceTest.cs @@ -1,62 +1,57 @@ -using InvoiceCreateParamsProperties = Orb.Models.Invoices.InvoiceCreateParamsProperties; -using InvoiceListParamsProperties = Orb.Models.Invoices.InvoiceListParamsProperties; -using Invoices = Orb.Models.Invoices; -using LineItemProperties = Orb.Models.Invoices.InvoiceCreateParamsProperties.LineItemProperties; -using Models = Orb.Models; -using PercentageDiscountProperties = Orb.Models.PercentageDiscountProperties; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using TransformPriceFilterProperties = Orb.Models.TransformPriceFilterProperties; +using System; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Invoices.InvoiceCreateParamsProperties.LineItemProperties; +using Orb.Models.Invoices.InvoiceListParamsProperties; +using Orb.Models.PercentageDiscountProperties; +using Orb.Models.TransformPriceFilterProperties; namespace Orb.Tests.Service.Invoices; -public class InvoiceServiceTest : Tests::TestBase +public class InvoiceServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var invoice = await this.client.Invoices.Create( - new Invoices::InvoiceCreateParams() + new() { Currency = "USD", - InvoiceDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), LineItems = [ - new InvoiceCreateParamsProperties::LineItem() + new() { - EndDate = System::DateOnly.Parse("2023-09-22"), + EndDate = DateOnly.Parse("2023-09-22"), ItemID = "4khy3nwzktxv7", - ModelType = LineItemProperties::ModelType.Unit, + ModelType = ModelType.Unit, Name = "Line Item Name", Quantity = 1, - StartDate = System::DateOnly.Parse("2023-09-22"), - UnitConfig = new Models::UnitConfig() { UnitAmount = "unit_amount" }, + StartDate = DateOnly.Parse("2023-09-22"), + UnitConfig = new() { UnitAmount = "unit_amount" }, }, ], - NetTerms = 0, CustomerID = "4khy3nwzktxv7", - Discount = Models::Discount.Create( - new Models::PercentageDiscount() - { - DiscountType = PercentageDiscountProperties::DiscountType.Percentage, - PercentageDiscount1 = 0.15, - AppliesToPriceIDs = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - Reason = "reason", - } - ), + Discount = new PercentageDiscount() + { + DiscountType = DiscountType.Percentage, + PercentageDiscount1 = 0.15, + AppliesToPriceIDs = ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + Reason = "reason", + }, ExternalCustomerID = "external-customer-id", Memo = "An optional memo for my invoice.", Metadata = new() { { "foo", "string" } }, + NetTerms = 0, WillAutoIssue = false, } ); @@ -64,10 +59,10 @@ public class InvoiceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var invoice = await this.client.Invoices.Update( - new Invoices::InvoiceUpdateParams() + new() { InvoiceID = "invoice_id", Metadata = new() { { "foo", "string" } }, @@ -77,29 +72,29 @@ public class InvoiceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Invoices.List( - new Invoices::InvoiceListParams() + new() { Amount = "amount", AmountGt = "amount[gt]", AmountLt = "amount[lt]", Cursor = "cursor", CustomerID = "customer_id", - DateType = InvoiceListParamsProperties::DateType.DueDate, - DueDate = System::DateOnly.Parse("2019-12-27"), + DateType = DateType.DueDate, + DueDate = DateOnly.Parse("2019-12-27"), DueDateWindow = "due_date_window", - DueDateGt = System::DateOnly.Parse("2019-12-27"), - DueDateLt = System::DateOnly.Parse("2019-12-27"), + DueDateGt = DateOnly.Parse("2019-12-27"), + DueDateLt = DateOnly.Parse("2019-12-27"), ExternalCustomerID = "external_customer_id", - InvoiceDateGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - InvoiceDateGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - InvoiceDateLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - InvoiceDateLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceDateGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceDateGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceDateLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + InvoiceDateLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), IsRecurring = true, Limit = 1, - Status = [InvoiceListParamsProperties::Status.Draft], + Status = [Status.Draft], SubscriptionID = "subscription_id", } ); @@ -107,40 +102,38 @@ public class InvoiceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var invoice = await this.client.Invoices.Fetch( - new Invoices::InvoiceFetchParams() { InvoiceID = "invoice_id" } - ); + var invoice = await this.client.Invoices.Fetch(new() { InvoiceID = "invoice_id" }); invoice.Validate(); } [Fact] - public async Tasks::Task FetchUpcoming_Works() + public async Task FetchUpcoming_Works() { var response = await this.client.Invoices.FetchUpcoming( - new Invoices::InvoiceFetchUpcomingParams() { SubscriptionID = "subscription_id" } + new() { SubscriptionID = "subscription_id" } ); response.Validate(); } [Fact] - public async Tasks::Task Issue_Works() + public async Task Issue_Works() { var invoice = await this.client.Invoices.Issue( - new Invoices::InvoiceIssueParams() { InvoiceID = "invoice_id", Synchronous = true } + new() { InvoiceID = "invoice_id", Synchronous = true } ); invoice.Validate(); } [Fact] - public async Tasks::Task MarkPaid_Works() + public async Task MarkPaid_Works() { var invoice = await this.client.Invoices.MarkPaid( - new Invoices::InvoiceMarkPaidParams() + new() { InvoiceID = "invoice_id", - PaymentReceivedDate = System::DateOnly.Parse("2023-09-22"), + PaymentReceivedDate = DateOnly.Parse("2023-09-22"), ExternalID = "external_payment_id_123", Notes = "notes", } @@ -149,20 +142,16 @@ public class InvoiceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Pay_Works() + public async Task Pay_Works() { - var invoice = await this.client.Invoices.Pay( - new Invoices::InvoicePayParams() { InvoiceID = "invoice_id" } - ); + var invoice = await this.client.Invoices.Pay(new() { InvoiceID = "invoice_id" }); invoice.Validate(); } [Fact] - public async Tasks::Task Void_Works() + public async Task Void_Works() { - var invoice = await this.client.Invoices.Void( - new Invoices::InvoiceVoidParams() { InvoiceID = "invoice_id" } - ); + var invoice = await this.client.Invoices.Void(new() { InvoiceID = "invoice_id" }); invoice.Validate(); } } diff --git a/src/Orb.Tests/Service/Items/ItemServiceTest.cs b/src/Orb.Tests/Service/Items/ItemServiceTest.cs index 527042b1..e69d8077 100644 --- a/src/Orb.Tests/Service/Items/ItemServiceTest.cs +++ b/src/Orb.Tests/Service/Items/ItemServiceTest.cs @@ -1,18 +1,15 @@ -using ExternalConnectionProperties = Orb.Models.Items.ItemUpdateParamsProperties.ExternalConnectionProperties; -using Items = Orb.Models.Items; -using ItemUpdateParamsProperties = Orb.Models.Items.ItemUpdateParamsProperties; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; +using Orb.Models.Items.ItemUpdateParamsProperties.ExternalConnectionProperties; namespace Orb.Tests.Service.Items; -public class ItemServiceTest : Tests::TestBase +public class ItemServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var item = await this.client.Items.Create( - new Items::ItemCreateParams() + new() { Name = "API requests", Metadata = new() { { "foo", "string" } }, @@ -22,18 +19,17 @@ public class ItemServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var item = await this.client.Items.Update( - new Items::ItemUpdateParams() + new() { ItemID = "item_id", ExternalConnections = [ - new ItemUpdateParamsProperties::ExternalConnection() + new() { - ExternalConnectionName = - ExternalConnectionProperties::ExternalConnectionName.Stripe, + ExternalConnectionName = ExternalConnectionName.Stripe, ExternalEntityID = "external_entity_id", }, ], @@ -45,29 +41,23 @@ public class ItemServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { - var page = await this.client.Items.List( - new Items::ItemListParams() { Cursor = "cursor", Limit = 1 } - ); + var page = await this.client.Items.List(new() { Cursor = "cursor", Limit = 1 }); page.Validate(); } [Fact] - public async Tasks::Task Archive_Works() + public async Task Archive_Works() { - var item = await this.client.Items.Archive( - new Items::ItemArchiveParams() { ItemID = "item_id" } - ); + var item = await this.client.Items.Archive(new() { ItemID = "item_id" }); item.Validate(); } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var item = await this.client.Items.Fetch( - new Items::ItemFetchParams() { ItemID = "item_id" } - ); + var item = await this.client.Items.Fetch(new() { ItemID = "item_id" }); item.Validate(); } } diff --git a/src/Orb.Tests/Service/Metrics/MetricServiceTest.cs b/src/Orb.Tests/Service/Metrics/MetricServiceTest.cs index 03ecd3e8..d42fc481 100644 --- a/src/Orb.Tests/Service/Metrics/MetricServiceTest.cs +++ b/src/Orb.Tests/Service/Metrics/MetricServiceTest.cs @@ -1,17 +1,15 @@ -using Metrics = Orb.Models.Metrics; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System; +using System.Threading.Tasks; namespace Orb.Tests.Service.Metrics; -public class MetricServiceTest : Tests::TestBase +public class MetricServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var billableMetric = await this.client.Metrics.Create( - new Metrics::MetricCreateParams() + new() { Description = "Sum of bytes downloaded in fast mode", ItemID = "item_id", @@ -24,10 +22,10 @@ public class MetricServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var billableMetric = await this.client.Metrics.Update( - new Metrics::MetricUpdateParams() + new() { MetricID = "metric_id", Metadata = new() { { "foo", "string" } }, @@ -37,15 +35,15 @@ public class MetricServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Metrics.List( - new Metrics::MetricListParams() + new() { - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", Limit = 1, } @@ -54,11 +52,9 @@ public class MetricServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var billableMetric = await this.client.Metrics.Fetch( - new Metrics::MetricFetchParams() { MetricID = "metric_id" } - ); + var billableMetric = await this.client.Metrics.Fetch(new() { MetricID = "metric_id" }); billableMetric.Validate(); } } diff --git a/src/Orb.Tests/Service/Plans/ExternalPlanID/ExternalPlanIDServiceTest.cs b/src/Orb.Tests/Service/Plans/ExternalPlanID/ExternalPlanIDServiceTest.cs index 8db96387..aa8b926d 100644 --- a/src/Orb.Tests/Service/Plans/ExternalPlanID/ExternalPlanIDServiceTest.cs +++ b/src/Orb.Tests/Service/Plans/ExternalPlanID/ExternalPlanIDServiceTest.cs @@ -1,16 +1,14 @@ -using ExternalPlanID = Orb.Models.Plans.ExternalPlanID; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.Plans.ExternalPlanID; -public class ExternalPlanIDServiceTest : Tests::TestBase +public class ExternalPlanIDServiceTest : TestBase { [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var plan = await this.client.Plans.ExternalPlanID.Update( - new ExternalPlanID::ExternalPlanIDUpdateParams() + new() { OtherExternalPlanID = "external_plan_id", ExternalPlanID = "external_plan_id", @@ -21,10 +19,10 @@ public class ExternalPlanIDServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { var plan = await this.client.Plans.ExternalPlanID.Fetch( - new ExternalPlanID::ExternalPlanIDFetchParams() { ExternalPlanID = "external_plan_id" } + new() { ExternalPlanID = "external_plan_id" } ); plan.Validate(); } diff --git a/src/Orb.Tests/Service/Plans/PlanServiceTest.cs b/src/Orb.Tests/Service/Plans/PlanServiceTest.cs index 88311583..c140b5dd 100644 --- a/src/Orb.Tests/Service/Plans/PlanServiceTest.cs +++ b/src/Orb.Tests/Service/Plans/PlanServiceTest.cs @@ -1,136 +1,113 @@ -using AdjustmentProperties = Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties; -using CustomExpirationProperties = Orb.Models.CustomExpirationProperties; -using Models = Orb.Models; -using NewAllocationPriceProperties = Orb.Models.NewAllocationPriceProperties; +using System; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.CustomExpirationProperties; +using Orb.Models.NewAllocationPriceProperties; +using Orb.Models.NewPercentageDiscountProperties; +using Orb.Models.Plans.PlanListParamsProperties; +using Orb.Models.TransformPriceFilterProperties; +using Orb.Models.UnitConversionRateConfigProperties; using NewBillingCycleConfigurationProperties = Orb.Models.NewBillingCycleConfigurationProperties; -using NewPercentageDiscountProperties = Orb.Models.NewPercentageDiscountProperties; using NewPlanUnitPriceProperties = Orb.Models.NewPlanUnitPriceProperties; using PlanCreateParamsProperties = Orb.Models.Plans.PlanCreateParamsProperties; -using PlanListParamsProperties = Orb.Models.Plans.PlanListParamsProperties; using PlanPhaseProperties = Orb.Models.Plans.PlanCreateParamsProperties.PlanPhaseProperties; -using Plans = Orb.Models.Plans; -using PriceProperties = Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using TransformPriceFilterProperties = Orb.Models.TransformPriceFilterProperties; -using UnitConversionRateConfigProperties = Orb.Models.UnitConversionRateConfigProperties; namespace Orb.Tests.Service.Plans; -public class PlanServiceTest : Tests::TestBase +public class PlanServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var plan = await this.client.Plans.Create( - new Plans::PlanCreateParams() + new() { Currency = "currency", Name = "name", Prices = [ - new PlanCreateParamsProperties::Price() + new() { - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", - Cadence = NewAllocationPriceProperties::Cadence.Monthly, + Cadence = Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, PlanPhaseOrder = 0, - Price1 = PriceProperties::Price.Create( - new Models::NewPlanUnitPrice() + Price = new NewPlanUnitPrice() + { + Cadence = NewPlanUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewPlanUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewPlanUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewPlanUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewPlanUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, }, ], Adjustments = [ - new PlanCreateParamsProperties::Adjustment() + new() { - Adjustment1 = AdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment1 = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, PlanPhaseOrder = 0, }, ], @@ -140,7 +117,7 @@ public class PlanServiceTest : Tests::TestBase NetTerms = 0, PlanPhases = [ - new PlanCreateParamsProperties::PlanPhase() + new() { Order = 0, AlignBillingWithPhaseStartDate = true, @@ -155,10 +132,10 @@ public class PlanServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var plan = await this.client.Plans.Update( - new Plans::PlanUpdateParams() + new() { PlanID = "plan_id", ExternalPlanID = "external_plan_id", @@ -169,29 +146,27 @@ public class PlanServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Plans.List( - new Plans::PlanListParams() + new() { - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", Limit = 1, - Status = PlanListParamsProperties::Status.Active, + Status = Status.Active, } ); page.Validate(); } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var plan = await this.client.Plans.Fetch( - new Plans::PlanFetchParams() { PlanID = "plan_id" } - ); + var plan = await this.client.Plans.Fetch(new() { PlanID = "plan_id" }); plan.Validate(); } } diff --git a/src/Orb.Tests/Service/Prices/ExternalPriceID/ExternalPriceIDServiceTest.cs b/src/Orb.Tests/Service/Prices/ExternalPriceID/ExternalPriceIDServiceTest.cs index a4a05f58..3d9696fa 100644 --- a/src/Orb.Tests/Service/Prices/ExternalPriceID/ExternalPriceIDServiceTest.cs +++ b/src/Orb.Tests/Service/Prices/ExternalPriceID/ExternalPriceIDServiceTest.cs @@ -1,16 +1,14 @@ -using ExternalPriceID = Orb.Models.Prices.ExternalPriceID; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.Prices.ExternalPriceID; -public class ExternalPriceIDServiceTest : Tests::TestBase +public class ExternalPriceIDServiceTest : TestBase { [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var price = await this.client.Prices.ExternalPriceID.Update( - new ExternalPriceID::ExternalPriceIDUpdateParams() + new() { ExternalPriceID = "external_price_id", Metadata = new() { { "foo", "string" } }, @@ -20,13 +18,10 @@ public class ExternalPriceIDServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { var price = await this.client.Prices.ExternalPriceID.Fetch( - new ExternalPriceID::ExternalPriceIDFetchParams() - { - ExternalPriceID = "external_price_id", - } + new() { ExternalPriceID = "external_price_id" } ); price.Validate(); } diff --git a/src/Orb.Tests/Service/Prices/PriceServiceTest.cs b/src/Orb.Tests/Service/Prices/PriceServiceTest.cs index 2ea6f903..f4948533 100644 --- a/src/Orb.Tests/Service/Prices/PriceServiceTest.cs +++ b/src/Orb.Tests/Service/Prices/PriceServiceTest.cs @@ -1,86 +1,68 @@ -using Json = System.Text.Json; -using Models = Orb.Models; -using NewBillingCycleConfigurationProperties = Orb.Models.NewBillingCycleConfigurationProperties; -using NewFloatingUnitPriceProperties = Orb.Models.NewFloatingUnitPriceProperties; -using PriceCreateParamsProperties = Orb.Models.Prices.PriceCreateParamsProperties; -using PriceEvaluateMultipleParamsProperties = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties; -using PriceEvaluatePreviewEventsParamsProperties = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties; -using PriceEvaluationProperties = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties; -using PriceEvaluationProperties1 = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties; -using Prices = Orb.Models.Prices; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using UnitConversionRateConfigProperties = Orb.Models.UnitConversionRateConfigProperties; +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.NewBillingCycleConfigurationProperties; +using Orb.Models.NewFloatingUnitPriceProperties; +using Orb.Models.UnitConversionRateConfigProperties; namespace Orb.Tests.Service.Prices; -public class PriceServiceTest : Tests::TestBase +public class PriceServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var price = await this.client.Prices.Create( - new Prices::PriceCreateParams() + new() { - Body = PriceCreateParamsProperties::Body.Create( - new Models::NewFloatingUnitPrice() + Body = new NewFloatingUnitPrice() + { + Cadence = Cadence.Annual, + Currency = "currency", + ItemID = "item_id", + ModelType = ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewFloatingUnitPriceProperties::Cadence.Annual, - Currency = "currency", - ItemID = "item_id", - ModelType = NewFloatingUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() { UnitAmount = "unit_amount" }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewFloatingUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - } - ), + Duration = 0, + DurationUnit = DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + }, } ); price.Validate(); } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var price = await this.client.Prices.Update( - new Prices::PriceUpdateParams() + new() { PriceID = "price_id", Metadata = new() { { "foo", "string" } }, @@ -90,23 +72,21 @@ public class PriceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { - var page = await this.client.Prices.List( - new Prices::PriceListParams() { Cursor = "cursor", Limit = 1 } - ); + var page = await this.client.Prices.List(new() { Cursor = "cursor", Limit = 1 }); page.Validate(); } [Fact] - public async Tasks::Task Evaluate_Works() + public async Task Evaluate_Works() { var response = await this.client.Prices.Evaluate( - new Prices::PriceEvaluateParams() + new() { PriceID = "price_id", - TimeframeEnd = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - TimeframeStart = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeEnd = DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeStart = DateTime.Parse("2019-12-27T18:11:19.117Z"), CustomerID = "customer_id", ExternalCustomerID = "external_customer_id", Filter = "my_numeric_property > 100 AND my_other_property = 'bar'", @@ -117,77 +97,60 @@ public class PriceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task EvaluateMultiple_Works() + public async Task EvaluateMultiple_Works() { var response = await this.client.Prices.EvaluateMultiple( - new Prices::PriceEvaluateMultipleParams() + new() { - TimeframeEnd = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - TimeframeStart = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeEnd = DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeStart = DateTime.Parse("2019-12-27T18:11:19.117Z"), CustomerID = "customer_id", ExternalCustomerID = "external_customer_id", PriceEvaluations = [ - new PriceEvaluateMultipleParamsProperties::PriceEvaluation() + new() { ExternalPriceID = "external_price_id", Filter = "my_numeric_property > 100 AND my_other_property = 'bar'", GroupingKeys = ["case when my_event_type = 'foo' then true else false end"], - Price = PriceEvaluationProperties::Price.Create( - new Models::NewFloatingUnitPrice() + Price = new NewFloatingUnitPrice() + { + Cadence = Cadence.Annual, + Currency = "currency", + ItemID = "item_id", + ModelType = ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + DimensionalPriceConfiguration = new() { - Cadence = NewFloatingUnitPriceProperties::Cadence.Annual, - Currency = "currency", - ItemID = "item_id", - ModelType = NewFloatingUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewFloatingUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - } - ), + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + }, PriceID = "price_id", }, ], @@ -197,24 +160,21 @@ public class PriceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task EvaluatePreviewEvents_Works() + public async Task EvaluatePreviewEvents_Works() { var response = await this.client.Prices.EvaluatePreviewEvents( - new Prices::PriceEvaluatePreviewEventsParams() + new() { - TimeframeEnd = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - TimeframeStart = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeEnd = DateTime.Parse("2019-12-27T18:11:19.117Z"), + TimeframeStart = DateTime.Parse("2019-12-27T18:11:19.117Z"), CustomerID = "customer_id", Events = [ - new PriceEvaluatePreviewEventsParamsProperties::Event() + new() { EventName = "event_name", - Properties1 = new() - { - { "foo", Json::JsonSerializer.SerializeToElement("bar") }, - }, - Timestamp = System::DateTime.Parse("2020-12-09T16:09:53Z"), + Properties1 = new() { { "foo", JsonSerializer.SerializeToElement("bar") } }, + Timestamp = DateTime.Parse("2020-12-09T16:09:53Z"), CustomerID = "customer_id", ExternalCustomerID = "external_customer_id", }, @@ -222,66 +182,49 @@ public class PriceServiceTest : Tests::TestBase ExternalCustomerID = "external_customer_id", PriceEvaluations = [ - new PriceEvaluatePreviewEventsParamsProperties::PriceEvaluation() + new() { ExternalPriceID = "external_price_id", Filter = "my_numeric_property > 100 AND my_other_property = 'bar'", GroupingKeys = ["case when my_event_type = 'foo' then true else false end"], - Price = PriceEvaluationProperties1::Price.Create( - new Models::NewFloatingUnitPrice() + Price = new NewFloatingUnitPrice() + { + Cadence = Cadence.Annual, + Currency = "currency", + ItemID = "item_id", + ModelType = ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() { - Cadence = NewFloatingUnitPriceProperties::Cadence.Annual, - Currency = "currency", - ItemID = "item_id", - ModelType = NewFloatingUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewFloatingUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - } - ), + Duration = 0, + DurationUnit = DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + }, PriceID = "price_id", }, ], @@ -291,11 +234,9 @@ public class PriceServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { - var price = await this.client.Prices.Fetch( - new Prices::PriceFetchParams() { PriceID = "price_id" } - ); + var price = await this.client.Prices.Fetch(new() { PriceID = "price_id" }); price.Validate(); } } diff --git a/src/Orb.Tests/Service/SubscriptionChanges/SubscriptionChangeServiceTest.cs b/src/Orb.Tests/Service/SubscriptionChanges/SubscriptionChangeServiceTest.cs index 25aed8e5..59faf905 100644 --- a/src/Orb.Tests/Service/SubscriptionChanges/SubscriptionChangeServiceTest.cs +++ b/src/Orb.Tests/Service/SubscriptionChanges/SubscriptionChangeServiceTest.cs @@ -1,28 +1,23 @@ -using SubscriptionChanges = Orb.Models.SubscriptionChanges; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; +using System.Threading.Tasks; namespace Orb.Tests.Service.SubscriptionChanges; -public class SubscriptionChangeServiceTest : Tests::TestBase +public class SubscriptionChangeServiceTest : TestBase { [Fact] - public async Tasks::Task Retrieve_Works() + public async Task Retrieve_Works() { var subscriptionChange = await this.client.SubscriptionChanges.Retrieve( - new SubscriptionChanges::SubscriptionChangeRetrieveParams() - { - SubscriptionChangeID = "subscription_change_id", - } + new() { SubscriptionChangeID = "subscription_change_id" } ); subscriptionChange.Validate(); } [Fact] - public async Tasks::Task Apply_Works() + public async Task Apply_Works() { var response = await this.client.SubscriptionChanges.Apply( - new SubscriptionChanges::SubscriptionChangeApplyParams() + new() { SubscriptionChangeID = "subscription_change_id", Description = "description", @@ -33,13 +28,10 @@ public class SubscriptionChangeServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Cancel_Works() + public async Task Cancel_Works() { var response = await this.client.SubscriptionChanges.Cancel( - new SubscriptionChanges::SubscriptionChangeCancelParams() - { - SubscriptionChangeID = "subscription_change_id", - } + new() { SubscriptionChangeID = "subscription_change_id" } ); response.Validate(); } diff --git a/src/Orb.Tests/Service/Subscriptions/SubscriptionServiceTest.cs b/src/Orb.Tests/Service/Subscriptions/SubscriptionServiceTest.cs index 3c6dffc8..5adc0adb 100644 --- a/src/Orb.Tests/Service/Subscriptions/SubscriptionServiceTest.cs +++ b/src/Orb.Tests/Service/Subscriptions/SubscriptionServiceTest.cs @@ -1,181 +1,146 @@ -using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddAdjustmentProperties; -using AddAdjustmentProperties1 = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; -using AddAdjustmentProperties2 = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddAdjustmentProperties; -using AddPriceProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties; -using AddPriceProperties1 = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties; -using AddProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -using AmountProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.AmountProperties; -using CustomExpirationProperties = Orb.Models.CustomExpirationProperties; -using DiscountOverrideProperties = Orb.Models.Subscriptions.DiscountOverrideProperties; -using DiscountProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; -using EditAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties; -using EditProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties; -using Json = System.Text.Json; -using Models = Orb.Models; +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.CustomExpirationProperties; +using Orb.Models.NewFloatingUnitPriceProperties; +using Orb.Models.NewPercentageDiscountProperties; +using Orb.Models.Subscriptions; +using Orb.Models.Subscriptions.DiscountOverrideProperties; +using Orb.Models.Subscriptions.SubscriptionCancelParamsProperties; +using Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; +using Orb.Models.Subscriptions.SubscriptionFetchCostsParamsProperties; +using Orb.Models.Subscriptions.SubscriptionListParamsProperties; +using Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; +using Orb.Models.Subscriptions.SubscriptionRedeemCouponParamsProperties; +using Orb.Models.TransformPriceFilterProperties; +using Orb.Models.UnitConversionRateConfigProperties; using NewAllocationPriceProperties = Orb.Models.NewAllocationPriceProperties; using NewBillingCycleConfigurationProperties = Orb.Models.NewBillingCycleConfigurationProperties; -using NewFloatingUnitPriceProperties = Orb.Models.NewFloatingUnitPriceProperties; -using NewPercentageDiscountProperties = Orb.Models.NewPercentageDiscountProperties; using NewSubscriptionUnitPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties; -using ReplaceAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplaceAdjustmentProperties; -using ReplaceAdjustmentProperties1 = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplaceAdjustmentProperties; -using ReplacePriceProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties; -using ReplacePriceProperties1 = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties; -using SubscriptionCancelParamsProperties = Orb.Models.Subscriptions.SubscriptionCancelParamsProperties; -using SubscriptionCreateParamsProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -using SubscriptionFetchCostsParamsProperties = Orb.Models.Subscriptions.SubscriptionFetchCostsParamsProperties; using SubscriptionFetchUsageParamsProperties = Orb.Models.Subscriptions.SubscriptionFetchUsageParamsProperties; -using SubscriptionListParamsProperties = Orb.Models.Subscriptions.SubscriptionListParamsProperties; -using SubscriptionPriceIntervalsParamsProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties; -using SubscriptionRedeemCouponParamsProperties = Orb.Models.Subscriptions.SubscriptionRedeemCouponParamsProperties; -using Subscriptions = Orb.Models.Subscriptions; using SubscriptionSchedulePlanChangeParamsProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; using SubscriptionUpdateFixedFeeQuantityParamsProperties = Orb.Models.Subscriptions.SubscriptionUpdateFixedFeeQuantityParamsProperties; -using SubscriptionUpdateTrialParamsProperties = Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties; -using System = System; -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using TransformPriceFilterProperties = Orb.Models.TransformPriceFilterProperties; -using UnitConversionRateConfigProperties = Orb.Models.UnitConversionRateConfigProperties; namespace Orb.Tests.Service.Subscriptions; -public class SubscriptionServiceTest : Tests::TestBase +public class SubscriptionServiceTest : TestBase { [Fact] - public async Tasks::Task Create_Works() + public async Task Create_Works() { var mutatedSubscription = await this.client.Subscriptions.Create( - new Subscriptions::SubscriptionCreateParams() + new() { AddAdjustments = [ - new SubscriptionCreateParamsProperties::AddAdjustment() + new() { - Adjustment = AddAdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), - EndDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), PlanPhaseOrder = 0, - StartDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), }, ], AddPrices = [ - new SubscriptionCreateParamsProperties::AddPrice() + new() { - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", Cadence = NewAllocationPriceProperties::Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, Discounts = [ - new Subscriptions::DiscountOverride() + new() { - DiscountType = DiscountOverrideProperties::DiscountType.Percentage, + DiscountType = DiscountType.Percentage, AmountDiscount = "amount_discount", PercentageDiscount = 0.15, UsageDiscount = 0, }, ], - EndDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), ExternalPriceID = "external_price_id", MaximumAmount = "1.23", MinimumAmount = "1.23", PlanPhaseOrder = 0, - Price = AddPriceProperties::Price.Create( - new Subscriptions::NewSubscriptionUnitPrice() + Price = new NewSubscriptionUnitPrice() + { + Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewSubscriptionUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, PriceID = "h74gfhdjvn7ujokd", - StartDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), }, ], AlignBillingWithSubscriptionStartDate = true, AutoCollection = true, AwsRegion = "aws_region", - BillingCycleAnchorConfiguration = new Models::BillingCycleAnchorConfiguration() + BillingCycleAnchorConfiguration = new() { Day = 1, Month = 1, @@ -186,10 +151,9 @@ public class SubscriptionServiceTest : Tests::TestBase Currency = "currency", CustomerID = "customer_id", DefaultInvoiceMemo = "default_invoice_memo", - EndDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), ExternalCustomerID = "external_customer_id", - ExternalMarketplace = - SubscriptionCreateParamsProperties::ExternalMarketplace.Google, + ExternalMarketplace = ExternalMarketplace.Google, ExternalMarketplaceReportingID = "external_marketplace_reporting_id", ExternalPlanID = "ZMwNQefe7J3ecf7W", Filter = "my_property > 100 AND my_other_property = 'bar'", @@ -201,75 +165,61 @@ public class SubscriptionServiceTest : Tests::TestBase PerCreditOverageAmount = 0, PlanID = "ZMwNQefe7J3ecf7W", PlanVersionNumber = 0, - PriceOverrides = [Json::JsonSerializer.Deserialize("{}")], - RemoveAdjustments = - [ - new SubscriptionCreateParamsProperties::RemoveAdjustment() - { - AdjustmentID = "h74gfhdjvn7ujokd", - }, - ], + PriceOverrides = [JsonSerializer.Deserialize("{}")], + RemoveAdjustments = [new() { AdjustmentID = "h74gfhdjvn7ujokd" }], RemovePrices = [ - new SubscriptionCreateParamsProperties::RemovePrice() - { - ExternalPriceID = "external_price_id", - PriceID = "h74gfhdjvn7ujokd", - }, + new() { ExternalPriceID = "external_price_id", PriceID = "h74gfhdjvn7ujokd" }, ], ReplaceAdjustments = [ - new SubscriptionCreateParamsProperties::ReplaceAdjustment() + new() { - Adjustment = ReplaceAdjustmentProperties::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, ReplacesAdjustmentID = "replaces_adjustment_id", }, ], ReplacePrices = [ - new SubscriptionCreateParamsProperties::ReplacePrice() + new() { ReplacesPriceID = "replaces_price_id", - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", Cadence = NewAllocationPriceProperties::Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, Discounts = [ - new Subscriptions::DiscountOverride() + new() { - DiscountType = DiscountOverrideProperties::DiscountType.Percentage, + DiscountType = DiscountType.Percentage, AmountDiscount = "amount_discount", PercentageDiscount = 0.15, UsageDiscount = 0, @@ -279,66 +229,51 @@ public class SubscriptionServiceTest : Tests::TestBase FixedPriceQuantity = 2, MaximumAmount = "1.23", MinimumAmount = "1.23", - Price = ReplacePriceProperties::Price.Create( - new Subscriptions::NewSubscriptionUnitPrice() + Price = new NewSubscriptionUnitPrice() + { + Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewSubscriptionUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, PriceID = "h74gfhdjvn7ujokd", }, ], - StartDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), TrialDurationDays = 0, UsageCustomerIDs = ["string"], } @@ -347,10 +282,10 @@ public class SubscriptionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task Update_Works() + public async Task Update_Works() { var subscription = await this.client.Subscriptions.Update( - new Subscriptions::SubscriptionUpdateParams() + new() { SubscriptionID = "subscription_id", AutoCollection = true, @@ -364,89 +299,88 @@ public class SubscriptionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task List_Works() + public async Task List_Works() { var page = await this.client.Subscriptions.List( - new Subscriptions::SubscriptionListParams() + new() { - CreatedAtGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - CreatedAtLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + CreatedAtLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), Cursor = "cursor", CustomerID = ["string"], ExternalCustomerID = ["string"], Limit = 1, - Status = SubscriptionListParamsProperties::Status.Active, + Status = Status.Active, } ); page.Validate(); } [Fact] - public async Tasks::Task Cancel_Works() + public async Task Cancel_Works() { var mutatedSubscription = await this.client.Subscriptions.Cancel( - new Subscriptions::SubscriptionCancelParams() + new() { SubscriptionID = "subscription_id", - CancelOption = - SubscriptionCancelParamsProperties::CancelOption.EndOfSubscriptionTerm, + CancelOption = CancelOption.EndOfSubscriptionTerm, AllowInvoiceCreditOrVoid = true, - CancellationDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + CancellationDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), } ); mutatedSubscription.Validate(); } [Fact] - public async Tasks::Task Fetch_Works() + public async Task Fetch_Works() { var subscription = await this.client.Subscriptions.Fetch( - new Subscriptions::SubscriptionFetchParams() { SubscriptionID = "subscription_id" } + new() { SubscriptionID = "subscription_id" } ); subscription.Validate(); } [Fact] - public async Tasks::Task FetchCosts_Works() + public async Task FetchCosts_Works() { var response = await this.client.Subscriptions.FetchCosts( - new Subscriptions::SubscriptionFetchCostsParams() + new() { SubscriptionID = "subscription_id", Currency = "currency", - TimeframeEnd = System::DateTime.Parse("2022-03-01T05:00:00Z"), - TimeframeStart = System::DateTime.Parse("2022-02-01T05:00:00Z"), - ViewMode = SubscriptionFetchCostsParamsProperties::ViewMode.Periodic, + TimeframeEnd = DateTime.Parse("2022-03-01T05:00:00Z"), + TimeframeStart = DateTime.Parse("2022-02-01T05:00:00Z"), + ViewMode = ViewMode.Periodic, } ); response.Validate(); } [Fact] - public async Tasks::Task FetchSchedule_Works() + public async Task FetchSchedule_Works() { var page = await this.client.Subscriptions.FetchSchedule( - new Subscriptions::SubscriptionFetchScheduleParams() + new() { SubscriptionID = "subscription_id", Cursor = "cursor", Limit = 1, - StartDateGt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - StartDateGte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - StartDateLt = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), - StartDateLte = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDateGt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDateGte = DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDateLt = DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDateLte = DateTime.Parse("2019-12-27T18:11:19.117Z"), } ); page.Validate(); } [Fact] - public async Tasks::Task FetchUsage_Works() + public async Task FetchUsage_Works() { var subscriptionUsage = await this.client.Subscriptions.FetchUsage( - new Subscriptions::SubscriptionFetchUsageParams() + new() { SubscriptionID = "subscription_id", BillableMetricID = "billable_metric_id", @@ -456,8 +390,8 @@ public class SubscriptionServiceTest : Tests::TestBase GroupBy = "group_by", SecondDimensionKey = "second_dimension_key", SecondDimensionValue = "second_dimension_value", - TimeframeEnd = System::DateTime.Parse("2022-03-01T05:00:00Z"), - TimeframeStart = System::DateTime.Parse("2022-02-01T05:00:00Z"), + TimeframeEnd = DateTime.Parse("2022-03-01T05:00:00Z"), + TimeframeStart = DateTime.Parse("2022-02-01T05:00:00Z"), ViewMode = SubscriptionFetchUsageParamsProperties::ViewMode.Periodic, } ); @@ -465,187 +399,143 @@ public class SubscriptionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task PriceIntervals_Works() + public async Task PriceIntervals_Works() { var mutatedSubscription = await this.client.Subscriptions.PriceIntervals( - new Subscriptions::SubscriptionPriceIntervalsParams() + new() { SubscriptionID = "subscription_id", Add = [ - new SubscriptionPriceIntervalsParamsProperties::Add() + new() { - StartDate = AddProperties::StartDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), - AllocationPrice = new Models::NewAllocationPrice() + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + AllocationPrice = new() { Amount = "10.00", Cadence = NewAllocationPriceProperties::Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, - Discounts = - [ - AddProperties::Discount.Create( - new DiscountProperties::Amount() - { - AmountDiscount = 0, - DiscountType = AmountProperties::DiscountType.Amount, - } - ), - ], - EndDate = AddProperties::EndDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), + Discounts = [new Amount() { AmountDiscount = 0 }], + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), ExternalPriceID = "external_price_id", Filter = "my_property > 100 AND my_other_property = 'bar'", FixedFeeQuantityTransitions = [ - new AddProperties::FixedFeeQuantityTransition() + new() { - EffectiveDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + EffectiveDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), Quantity = 5, }, ], MaximumAmount = 0, MinimumAmount = 0, - Price = AddProperties::Price.Create( - new Models::NewFloatingUnitPrice() + Price = new NewFloatingUnitPrice() + { + Cadence = Cadence.Annual, + Currency = "currency", + ItemID = "item_id", + ModelType = ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewFloatingUnitPriceProperties::Cadence.Annual, - Currency = "currency", - ItemID = "item_id", - ModelType = NewFloatingUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewFloatingUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + }, PriceID = "h74gfhdjvn7ujokd", UsageCustomerIDs = ["string"], }, ], AddAdjustments = [ - new SubscriptionPriceIntervalsParamsProperties::AddAdjustment() + new() { - Adjustment = AddAdjustmentProperties1::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), - StartDate = AddAdjustmentProperties1::StartDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), - EndDate = AddAdjustmentProperties1::EndDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), }, ], AllowInvoiceCreditOrVoid = true, Edit = [ - new SubscriptionPriceIntervalsParamsProperties::Edit() + new() { PriceIntervalID = "sdfs6wdjvn7ujokd", BillingCycleDay = 0, - EndDate = EditProperties::EndDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), Filter = "my_property > 100 AND my_other_property = 'bar'", FixedFeeQuantityTransitions = [ - new EditProperties::FixedFeeQuantityTransition() + new() { - EffectiveDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + EffectiveDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), Quantity = 5, }, ], - StartDate = EditProperties::StartDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), UsageCustomerIDs = ["string"], }, ], EditAdjustments = [ - new SubscriptionPriceIntervalsParamsProperties::EditAdjustment() + new() { AdjustmentIntervalID = "sdfs6wdjvn7ujokd", - EndDate = EditAdjustmentProperties::EndDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), - StartDate = EditAdjustmentProperties::StartDate.Create( - System::DateTime.Parse("2019-12-27T18:11:19.117Z") - ), + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), }, ], } @@ -654,15 +544,15 @@ public class SubscriptionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task RedeemCoupon_Works() + public async Task RedeemCoupon_Works() { var mutatedSubscription = await this.client.Subscriptions.RedeemCoupon( - new Subscriptions::SubscriptionRedeemCouponParams() + new() { SubscriptionID = "subscription_id", - ChangeOption = SubscriptionRedeemCouponParamsProperties::ChangeOption.RequestedDate, + ChangeOption = ChangeOption.RequestedDate, AllowInvoiceCreditOrVoid = true, - ChangeDate = System::DateTime.Parse("2017-07-21T17:32:28Z"), + ChangeDate = DateTime.Parse("2017-07-21T17:32:28Z"), CouponID = "coupon_id", CouponRedemptionCode = "coupon_redemption_code", } @@ -671,149 +561,130 @@ public class SubscriptionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task SchedulePlanChange_Works() + public async Task SchedulePlanChange_Works() { var mutatedSubscription = await this.client.Subscriptions.SchedulePlanChange( - new Subscriptions::SubscriptionSchedulePlanChangeParams() + new() { SubscriptionID = "subscription_id", ChangeOption = SubscriptionSchedulePlanChangeParamsProperties::ChangeOption.RequestedDate, AddAdjustments = [ - new SubscriptionSchedulePlanChangeParamsProperties::AddAdjustment() + new() { - Adjustment = AddAdjustmentProperties2::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), - EndDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), PlanPhaseOrder = 0, - StartDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), }, ], AddPrices = [ - new SubscriptionSchedulePlanChangeParamsProperties::AddPrice() + new() { - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", Cadence = NewAllocationPriceProperties::Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, Discounts = [ - new Subscriptions::DiscountOverride() + new() { - DiscountType = DiscountOverrideProperties::DiscountType.Percentage, + DiscountType = DiscountType.Percentage, AmountDiscount = "amount_discount", PercentageDiscount = 0.15, UsageDiscount = 0, }, ], - EndDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + EndDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), ExternalPriceID = "external_price_id", MaximumAmount = "1.23", MinimumAmount = "1.23", PlanPhaseOrder = 0, - Price = AddPriceProperties1::Price.Create( - new Subscriptions::NewSubscriptionUnitPrice() + Price = new NewSubscriptionUnitPrice() + { + Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewSubscriptionUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, PriceID = "h74gfhdjvn7ujokd", - StartDate = System::DateTime.Parse("2019-12-27T18:11:19.117Z"), + StartDate = DateTime.Parse("2019-12-27T18:11:19.117Z"), }, ], AlignBillingWithPlanChangeDate = true, AutoCollection = true, BillingCycleAlignment = SubscriptionSchedulePlanChangeParamsProperties::BillingCycleAlignment.Unchanged, - BillingCycleAnchorConfiguration = new Models::BillingCycleAnchorConfiguration() + BillingCycleAnchorConfiguration = new() { Day = 1, Month = 1, Year = 0, }, - ChangeDate = System::DateTime.Parse("2017-07-21T17:32:28Z"), + ChangeDate = DateTime.Parse("2017-07-21T17:32:28Z"), CouponRedemptionCode = "coupon_redemption_code", CreditsOverageRate = 0, DefaultInvoiceMemo = "default_invoice_memo", @@ -825,75 +696,61 @@ public class SubscriptionServiceTest : Tests::TestBase PerCreditOverageAmount = 0, PlanID = "ZMwNQefe7J3ecf7W", PlanVersionNumber = 0, - PriceOverrides = [Json::JsonSerializer.Deserialize("{}")], - RemoveAdjustments = - [ - new SubscriptionSchedulePlanChangeParamsProperties::RemoveAdjustment() - { - AdjustmentID = "h74gfhdjvn7ujokd", - }, - ], + PriceOverrides = [JsonSerializer.Deserialize("{}")], + RemoveAdjustments = [new() { AdjustmentID = "h74gfhdjvn7ujokd" }], RemovePrices = [ - new SubscriptionSchedulePlanChangeParamsProperties::RemovePrice() - { - ExternalPriceID = "external_price_id", - PriceID = "h74gfhdjvn7ujokd", - }, + new() { ExternalPriceID = "external_price_id", PriceID = "h74gfhdjvn7ujokd" }, ], ReplaceAdjustments = [ - new SubscriptionSchedulePlanChangeParamsProperties::ReplaceAdjustment() + new() { - Adjustment = ReplaceAdjustmentProperties1::Adjustment.Create( - new Models::NewPercentageDiscount() - { - AdjustmentType = - NewPercentageDiscountProperties::AdjustmentType.PercentageDiscount, - PercentageDiscount = 0, - AppliesToAll = NewPercentageDiscountProperties::AppliesToAll.True, - AppliesToItemIDs = ["item_1", "item_2"], - AppliesToPriceIDs = ["price_1", "price_2"], - Currency = "currency", - Filters = - [ - new Models::TransformPriceFilter() - { - Field = TransformPriceFilterProperties::Field.PriceID, - Operator = - TransformPriceFilterProperties::Operator.Includes, - Values = ["string"], - }, - ], - IsInvoiceLevel = true, - PriceType = NewPercentageDiscountProperties::PriceType.Usage, - } - ), + Adjustment = new NewPercentageDiscount() + { + AdjustmentType = AdjustmentType.PercentageDiscount, + PercentageDiscount = 0, + AppliesToAll = AppliesToAll.True, + AppliesToItemIDs = ["item_1", "item_2"], + AppliesToPriceIDs = ["price_1", "price_2"], + Currency = "currency", + Filters = + [ + new() + { + Field = Field.PriceID, + Operator = Operator.Includes, + Values = ["string"], + }, + ], + IsInvoiceLevel = true, + PriceType = PriceType.Usage, + }, ReplacesAdjustmentID = "replaces_adjustment_id", }, ], ReplacePrices = [ - new SubscriptionSchedulePlanChangeParamsProperties::ReplacePrice() + new() { ReplacesPriceID = "replaces_price_id", - AllocationPrice = new Models::NewAllocationPrice() + AllocationPrice = new() { Amount = "10.00", Cadence = NewAllocationPriceProperties::Cadence.Monthly, Currency = "USD", - CustomExpiration = new Models::CustomExpiration() + CustomExpiration = new() { Duration = 0, - DurationUnit = CustomExpirationProperties::DurationUnit.Day, + DurationUnit = DurationUnit.Day, }, ExpiresAtEndOfCadence = true, }, Discounts = [ - new Subscriptions::DiscountOverride() + new() { - DiscountType = DiscountOverrideProperties::DiscountType.Percentage, + DiscountType = DiscountType.Percentage, AmountDiscount = "amount_discount", PercentageDiscount = 0.15, UsageDiscount = 0, @@ -903,62 +760,47 @@ public class SubscriptionServiceTest : Tests::TestBase FixedPriceQuantity = 2, MaximumAmount = "1.23", MinimumAmount = "1.23", - Price = ReplacePriceProperties1::Price.Create( - new Subscriptions::NewSubscriptionUnitPrice() + Price = new NewSubscriptionUnitPrice() + { + Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, + ItemID = "item_id", + ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, + Name = "Annual fee", + UnitConfig = new() { UnitAmount = "unit_amount" }, + BillableMetricID = "billable_metric_id", + BilledInAdvance = true, + BillingCycleConfiguration = new() { - Cadence = NewSubscriptionUnitPriceProperties::Cadence.Annual, - ItemID = "item_id", - ModelType = NewSubscriptionUnitPriceProperties::ModelType.Unit, - Name = "Annual fee", - UnitConfig = new Models::UnitConfig() - { - UnitAmount = "unit_amount", - }, - BillableMetricID = "billable_metric_id", - BilledInAdvance = true, - BillingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - ConversionRate = 0, - ConversionRateConfig = - NewSubscriptionUnitPriceProperties::ConversionRateConfig.Create( - new Models::UnitConversionRateConfig() - { - ConversionRateType = - UnitConversionRateConfigProperties::ConversionRateType.Unit, - UnitConfig = new Models::ConversionRateUnitConfig() - { - UnitAmount = "unit_amount", - }, - } - ), - Currency = "currency", - DimensionalPriceConfiguration = - new Models::NewDimensionalPriceConfiguration() - { - DimensionValues = ["string"], - DimensionalPriceGroupID = "dimensional_price_group_id", - ExternalDimensionalPriceGroupID = - "external_dimensional_price_group_id", - }, - ExternalPriceID = "external_price_id", - FixedPriceQuantity = 0, - InvoiceGroupingKey = "x", - InvoicingCycleConfiguration = - new Models::NewBillingCycleConfiguration() - { - Duration = 0, - DurationUnit = - NewBillingCycleConfigurationProperties::DurationUnit.Day, - }, - Metadata = new() { { "foo", "string" } }, - ReferenceID = "reference_id", - } - ), + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + ConversionRate = 0, + ConversionRateConfig = new UnitConversionRateConfig() + { + ConversionRateType = ConversionRateType.Unit, + UnitConfig = new() { UnitAmount = "unit_amount" }, + }, + Currency = "currency", + DimensionalPriceConfiguration = new() + { + DimensionValues = ["string"], + DimensionalPriceGroupID = "dimensional_price_group_id", + ExternalDimensionalPriceGroupID = + "external_dimensional_price_group_id", + }, + ExternalPriceID = "external_price_id", + FixedPriceQuantity = 0, + InvoiceGroupingKey = "x", + InvoicingCycleConfiguration = new() + { + Duration = 0, + DurationUnit = + NewBillingCycleConfigurationProperties::DurationUnit.Day, + }, + Metadata = new() { { "foo", "string" } }, + ReferenceID = "reference_id", + }, PriceID = "h74gfhdjvn7ujokd", }, ], @@ -970,61 +812,51 @@ public class SubscriptionServiceTest : Tests::TestBase } [Fact] - public async Tasks::Task TriggerPhase_Works() + public async Task TriggerPhase_Works() { var mutatedSubscription = await this.client.Subscriptions.TriggerPhase( - new Subscriptions::SubscriptionTriggerPhaseParams() + new() { SubscriptionID = "subscription_id", AllowInvoiceCreditOrVoid = true, - EffectiveDate = System::DateOnly.Parse("2019-12-27"), + EffectiveDate = DateOnly.Parse("2019-12-27"), } ); mutatedSubscription.Validate(); } [Fact] - public async Tasks::Task UnscheduleCancellation_Works() + public async Task UnscheduleCancellation_Works() { var mutatedSubscription = await this.client.Subscriptions.UnscheduleCancellation( - new Subscriptions::SubscriptionUnscheduleCancellationParams() - { - SubscriptionID = "subscription_id", - } + new() { SubscriptionID = "subscription_id" } ); mutatedSubscription.Validate(); } [Fact] - public async Tasks::Task UnscheduleFixedFeeQuantityUpdates_Works() + public async Task UnscheduleFixedFeeQuantityUpdates_Works() { var mutatedSubscription = await this.client.Subscriptions.UnscheduleFixedFeeQuantityUpdates( - new Subscriptions::SubscriptionUnscheduleFixedFeeQuantityUpdatesParams() - { - SubscriptionID = "subscription_id", - PriceID = "price_id", - } + new() { SubscriptionID = "subscription_id", PriceID = "price_id" } ); mutatedSubscription.Validate(); } [Fact] - public async Tasks::Task UnschedulePendingPlanChanges_Works() + public async Task UnschedulePendingPlanChanges_Works() { var mutatedSubscription = await this.client.Subscriptions.UnschedulePendingPlanChanges( - new Subscriptions::SubscriptionUnschedulePendingPlanChangesParams() - { - SubscriptionID = "subscription_id", - } + new() { SubscriptionID = "subscription_id" } ); mutatedSubscription.Validate(); } [Fact] - public async Tasks::Task UpdateFixedFeeQuantity_Works() + public async Task UpdateFixedFeeQuantity_Works() { var mutatedSubscription = await this.client.Subscriptions.UpdateFixedFeeQuantity( - new Subscriptions::SubscriptionUpdateFixedFeeQuantityParams() + new() { SubscriptionID = "subscription_id", PriceID = "price_id", @@ -1032,22 +864,20 @@ public class SubscriptionServiceTest : Tests::TestBase AllowInvoiceCreditOrVoid = true, ChangeOption = SubscriptionUpdateFixedFeeQuantityParamsProperties::ChangeOption.Immediate, - EffectiveDate = System::DateOnly.Parse("2022-12-21"), + EffectiveDate = DateOnly.Parse("2022-12-21"), } ); mutatedSubscription.Validate(); } [Fact] - public async Tasks::Task UpdateTrial_Works() + public async Task UpdateTrial_Works() { var mutatedSubscription = await this.client.Subscriptions.UpdateTrial( - new Subscriptions::SubscriptionUpdateTrialParams() + new() { SubscriptionID = "subscription_id", - TrialEndDate = SubscriptionUpdateTrialParamsProperties::TrialEndDate.Create( - System::DateTime.Parse("2017-07-21T17:32:28Z") - ), + TrialEndDate = DateTime.Parse("2017-07-21T17:32:28Z"), Shift = true, } ); diff --git a/src/Orb.Tests/Service/TopLevel/TopLevelServiceTest.cs b/src/Orb.Tests/Service/TopLevel/TopLevelServiceTest.cs index 74d84075..028f2e9f 100644 --- a/src/Orb.Tests/Service/TopLevel/TopLevelServiceTest.cs +++ b/src/Orb.Tests/Service/TopLevel/TopLevelServiceTest.cs @@ -1,15 +1,13 @@ -using Tasks = System.Threading.Tasks; -using Tests = Orb.Tests; -using TopLevel = Orb.Models.TopLevel; +using System.Threading.Tasks; namespace Orb.Tests.Service.TopLevel; -public class TopLevelServiceTest : Tests::TestBase +public class TopLevelServiceTest : TestBase { [Fact] - public async Tasks::Task Ping_Works() + public async Task Ping_Works() { - var response = await this.client.TopLevel.Ping(new TopLevel::TopLevelPingParams() { }); + var response = await this.client.TopLevel.Ping(new() { }); response.Validate(); } } diff --git a/src/Orb.Tests/TestBase.cs b/src/Orb.Tests/TestBase.cs index f5a96be9..25433dbc 100644 --- a/src/Orb.Tests/TestBase.cs +++ b/src/Orb.Tests/TestBase.cs @@ -1,19 +1,18 @@ -using Orb = Orb; -using System = System; +using System; +using Orb; namespace Orb.Tests; public class TestBase { - protected Orb::IOrbClient client; + protected IOrbClient client; public TestBase() { - client = new Orb::OrbClient() + client = new OrbClient() { - BaseUrl = new System::Uri( - System::Environment.GetEnvironmentVariable("TEST_API_BASE_URL") - ?? "http://localhost:4010" + BaseUrl = new Uri( + Environment.GetEnvironmentVariable("TEST_API_BASE_URL") ?? "http://localhost:4010" ), APIKey = "My API Key", }; diff --git a/src/Orb/HttpException.cs b/src/Orb/HttpException.cs index 1e80f5bd..80aa144f 100644 --- a/src/Orb/HttpException.cs +++ b/src/Orb/HttpException.cs @@ -1,12 +1,12 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Net = System.Net; +using System.Diagnostics.CodeAnalysis; +using System.Net; using System = System; namespace Orb; public sealed class HttpException : System::Exception { - public required Net::HttpStatusCode? StatusCode { get; set; } + public required HttpStatusCode? StatusCode { get; set; } public required string ResponseBody { get; set; } public override string Message { @@ -20,8 +20,8 @@ public override string Message } } - [CodeAnalysis::SetsRequiredMembers] - public HttpException(Net::HttpStatusCode? statusCode, string responseBody) + [SetsRequiredMembers] + public HttpException(HttpStatusCode? statusCode, string responseBody) { this.StatusCode = statusCode; this.ResponseBody = responseBody; diff --git a/src/Orb/IOrbClient.cs b/src/Orb/IOrbClient.cs index 8cc9e40d..81f4844b 100644 --- a/src/Orb/IOrbClient.cs +++ b/src/Orb/IOrbClient.cs @@ -3,7 +3,6 @@ using Coupons = Orb.Service.Coupons; using CreditNotes = Orb.Service.CreditNotes; using Customers = Orb.Service.Customers; -using DimensionalPriceGroups = Orb.Service.DimensionalPriceGroups; using Events = Orb.Service.Events; using Http = System.Net.Http; using InvoiceLineItems = Orb.Service.InvoiceLineItems; @@ -13,7 +12,6 @@ using Plans = Orb.Service.Plans; using Prices = Orb.Service.Prices; using SubscriptionChanges = Orb.Service.SubscriptionChanges; -using Subscriptions = Orb.Service.Subscriptions; using System = System; using TopLevel = Orb.Service.TopLevel; @@ -51,11 +49,11 @@ public interface IOrbClient Prices::IPriceService Prices { get; } - Subscriptions::ISubscriptionService Subscriptions { get; } + global::Orb.Service.Subscriptions.ISubscriptionService Subscriptions { get; } Alerts::IAlertService Alerts { get; } - DimensionalPriceGroups::IDimensionalPriceGroupService DimensionalPriceGroups { get; } + global::Orb.Service.DimensionalPriceGroups.IDimensionalPriceGroupService DimensionalPriceGroups { get; } SubscriptionChanges::ISubscriptionChangeService SubscriptionChanges { get; } } diff --git a/src/Orb/JsonConverters.cs b/src/Orb/JsonConverters.cs index 72279107..8c7acc34 100644 --- a/src/Orb/JsonConverters.cs +++ b/src/Orb/JsonConverters.cs @@ -1,88 +1,78 @@ -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Linq = System.Linq; -using Reflection = System.Reflection; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb; -public sealed class ModelConverter : Serialization::JsonConverter +public sealed class ModelConverter : JsonConverter where MB : ModelBase, IFromRaw { public override MB? Read( - ref Json::Utf8JsonReader reader, + ref Utf8JsonReader reader, System::Type _typeToConvert, - Json::JsonSerializerOptions options + JsonSerializerOptions options ) { - Generic::Dictionary? properties = - Json::JsonSerializer.Deserialize>( - ref reader, - options - ); + Dictionary? properties = JsonSerializer.Deserialize< + Dictionary + >(ref reader, options); if (properties == null) return null; return MB.FromRawUnchecked(properties); } - public override void Write( - Json::Utf8JsonWriter writer, - MB value, - Json::JsonSerializerOptions options - ) + public override void Write(Utf8JsonWriter writer, MB value, JsonSerializerOptions options) { - Json::JsonSerializer.Serialize(writer, value.Properties, options); + JsonSerializer.Serialize(writer, value.Properties, options); } } -public sealed class EnumConverter : Serialization::JsonConverter +public sealed class EnumConverter : JsonConverter where IE : IEnum { public override IE Read( - ref Json::Utf8JsonReader reader, + ref Utf8JsonReader reader, System::Type _typeToConvert, - Json::JsonSerializerOptions options + JsonSerializerOptions options ) { - return IE.FromRaw(Json::JsonSerializer.Deserialize(ref reader, options)!); + return IE.FromRaw(JsonSerializer.Deserialize(ref reader, options)!); } - public override void Write( - Json::Utf8JsonWriter writer, - IE value, - Json::JsonSerializerOptions options - ) + public override void Write(Utf8JsonWriter writer, IE value, JsonSerializerOptions options) { - Json::JsonSerializer.Serialize(writer, value.Raw(), options); + JsonSerializer.Serialize(writer, value.Raw(), options); } } -public sealed class UnionConverter : Serialization::JsonConverter +public sealed class UnionConverter : JsonConverter where T : class { - readonly Generic::List _variantTypes = Linq::Enumerable.ToList( - Linq::Enumerable.Where( - Reflection::Assembly.GetExecutingAssembly().GetTypes(), + readonly List _variantTypes = Enumerable.ToList( + Enumerable.Where( + Assembly.GetExecutingAssembly().GetTypes(), type => type.BaseType == typeof(T) ) ); public override T? Read( - ref Json::Utf8JsonReader reader, + ref Utf8JsonReader reader, System::Type _typeToConvert, - Json::JsonSerializerOptions options + JsonSerializerOptions options ) { - Generic::List exceptions = []; + List exceptions = []; foreach (var variantType in _variantTypes) { try { - return Json::JsonSerializer.Deserialize(ref reader, variantType, options) as T; + return JsonSerializer.Deserialize(ref reader, variantType, options) as T; } - catch (Json::JsonException e) + catch (JsonException e) { exceptions.Add(e); } @@ -90,37 +80,29 @@ public sealed class UnionConverter : Serialization::JsonConverter throw new System::AggregateException(exceptions); } - public override void Write( - Json::Utf8JsonWriter writer, - T value, - Json::JsonSerializerOptions options - ) + public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) { var variantType = _variantTypes.Find(type => type == value.GetType()) ?? throw new System::ArgumentOutOfRangeException(value.GetType().Name); - Json::JsonSerializer.Serialize(writer, value, variantType, options); + JsonSerializer.Serialize(writer, value, variantType, options); } } -public sealed class VariantConverter : Serialization::JsonConverter +public sealed class VariantConverter : JsonConverter where IV : IVariant { public override IV Read( - ref Json::Utf8JsonReader reader, + ref Utf8JsonReader reader, System::Type _typeToConvert, - Json::JsonSerializerOptions options + JsonSerializerOptions options ) { - return IV.From(Json::JsonSerializer.Deserialize(ref reader, options)!); + return IV.From(JsonSerializer.Deserialize(ref reader, options)!); } - public override void Write( - Json::Utf8JsonWriter writer, - IV value, - Json::JsonSerializerOptions options - ) + public override void Write(Utf8JsonWriter writer, IV value, JsonSerializerOptions options) { - Json::JsonSerializer.Serialize(writer, value.Value, options); + JsonSerializer.Serialize(writer, value.Value, options); } } diff --git a/src/Orb/ModelBase.cs b/src/Orb/ModelBase.cs index da1f5e6e..f8e20521 100644 --- a/src/Orb/ModelBase.cs +++ b/src/Orb/ModelBase.cs @@ -1,20 +1,20 @@ -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Text.Json; namespace Orb; public abstract record class ModelBase { - public Generic::Dictionary Properties { get; set; } = []; + public Dictionary Properties { get; set; } = []; - static readonly Json::JsonSerializerOptions _toStringSerializerOptions = new() + static readonly JsonSerializerOptions _toStringSerializerOptions = new() { WriteIndented = true, }; public sealed override string? ToString() { - return Json::JsonSerializer.Serialize(this.Properties, _toStringSerializerOptions); + return JsonSerializer.Serialize(this.Properties, _toStringSerializerOptions); } public abstract void Validate(); @@ -22,5 +22,5 @@ public abstract record class ModelBase public interface IFromRaw { - static abstract T FromRawUnchecked(Generic::Dictionary properties); + static abstract T FromRawUnchecked(Dictionary properties); } diff --git a/src/Orb/Models/Address.cs b/src/Orb/Models/Address.cs index 93a6fd7f..df509085 100644 --- a/src/Orb/Models/Address.cs +++ b/src/Orb/Models/Address.cs @@ -1,91 +1,90 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter
))] -public sealed record class Address : Orb::ModelBase, Orb::IFromRaw
+[JsonConverter(typeof(ModelConverter
))] +public sealed record class Address : ModelBase, IFromRaw
{ public required string? City { get { - if (!this.Properties.TryGetValue("city", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("city", out JsonElement element)) throw new System::ArgumentOutOfRangeException("city", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["city"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["city"] = JsonSerializer.SerializeToElement(value); } } public required string? Country { get { - if (!this.Properties.TryGetValue("country", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("country", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "country", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["country"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["country"] = JsonSerializer.SerializeToElement(value); } } public required string? Line1 { get { - if (!this.Properties.TryGetValue("line1", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line1", out JsonElement element)) throw new System::ArgumentOutOfRangeException("line1", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["line1"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line1"] = JsonSerializer.SerializeToElement(value); } } public required string? Line2 { get { - if (!this.Properties.TryGetValue("line2", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line2", out JsonElement element)) throw new System::ArgumentOutOfRangeException("line2", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["line2"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line2"] = JsonSerializer.SerializeToElement(value); } } public required string? PostalCode { get { - if (!this.Properties.TryGetValue("postal_code", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("postal_code", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "postal_code", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["postal_code"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["postal_code"] = JsonSerializer.SerializeToElement(value); } } public required string? State { get { - if (!this.Properties.TryGetValue("state", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("state", out JsonElement element)) throw new System::ArgumentOutOfRangeException("state", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["state"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["state"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -101,16 +100,14 @@ public override void Validate() public Address() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Address(Generic::Dictionary properties) + [SetsRequiredMembers] + Address(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Address FromRawUnchecked( - Generic::Dictionary properties - ) + public static Address FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/AdjustmentInterval.cs b/src/Orb/Models/AdjustmentInterval.cs index eb203926..7f71a292 100644 --- a/src/Orb/Models/AdjustmentInterval.cs +++ b/src/Orb/Models/AdjustmentInterval.cs @@ -1,57 +1,55 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AdjustmentIntervalProperties = Orb.Models.AdjustmentIntervalProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AdjustmentInterval : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AdjustmentInterval : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required AdjustmentIntervalProperties::Adjustment Adjustment { get { - if (!this.Properties.TryGetValue("adjustment", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// /// The price interval IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIntervalIDs + public required List AppliesToPriceIntervalIDs { get { if ( !this.Properties.TryGetValue( "applies_to_price_interval_ids", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -59,13 +57,14 @@ public required string ID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_interval_ids"); } set { - this.Properties["applies_to_price_interval_ids"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -76,15 +75,15 @@ public required string ID { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,15 +93,15 @@ public required string ID { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -120,16 +119,14 @@ public override void Validate() public AdjustmentInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AdjustmentInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + AdjustmentInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AdjustmentInterval FromRawUnchecked( - Generic::Dictionary properties - ) + public static AdjustmentInterval FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/AdjustmentIntervalProperties/Adjustment.cs b/src/Orb/Models/AdjustmentIntervalProperties/Adjustment.cs index a58dae8b..d3163164 100644 --- a/src/Orb/Models/AdjustmentIntervalProperties/Adjustment.cs +++ b/src/Orb/Models/AdjustmentIntervalProperties/Adjustment.cs @@ -1,34 +1,27 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.AdjustmentIntervalProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.AdjustmentIntervalProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::PlanPhaseUsageDiscountAdjustment Create( - Models::PlanPhaseUsageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseUsageDiscountAdjustment value) => + new AdjustmentVariants::PlanPhaseUsageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseAmountDiscountAdjustment Create( - Models::PlanPhaseAmountDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseAmountDiscountAdjustment value) => + new AdjustmentVariants::PlanPhaseAmountDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhasePercentageDiscountAdjustment Create( - Models::PlanPhasePercentageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhasePercentageDiscountAdjustment value) => + new AdjustmentVariants::PlanPhasePercentageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseMinimumAdjustment Create( - Models::PlanPhaseMinimumAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseMinimumAdjustment value) => + new AdjustmentVariants::PlanPhaseMinimumAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseMaximumAdjustment Create( - Models::PlanPhaseMaximumAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseMaximumAdjustment value) => + new AdjustmentVariants::PlanPhaseMaximumAdjustmentVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/AdjustmentIntervalProperties/AdjustmentVariants/All.cs b/src/Orb/Models/AdjustmentIntervalProperties/AdjustmentVariants/All.cs index 8fa8a008..1cdc48eb 100644 --- a/src/Orb/Models/AdjustmentIntervalProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/AdjustmentIntervalProperties/AdjustmentVariants/All.cs @@ -1,24 +1,19 @@ -using AdjustmentIntervalProperties = Orb.Models.AdjustmentIntervalProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.AdjustmentIntervalProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhaseUsageDiscountAdjustment, - Models::PlanPhaseUsageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhaseUsageDiscountAdjustmentVariant, + PlanPhaseUsageDiscountAdjustment >) )] -public sealed record class PlanPhaseUsageDiscountAdjustment( - Models::PlanPhaseUsageDiscountAdjustment Value -) - : AdjustmentIntervalProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseUsageDiscountAdjustmentVariant( + PlanPhaseUsageDiscountAdjustment Value +) : Adjustment, IVariant { - public static PlanPhaseUsageDiscountAdjustment From( - Models::PlanPhaseUsageDiscountAdjustment value + public static PlanPhaseUsageDiscountAdjustmentVariant From( + PlanPhaseUsageDiscountAdjustment value ) { return new(value); @@ -30,20 +25,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhaseAmountDiscountAdjustment, - Models::PlanPhaseAmountDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhaseAmountDiscountAdjustmentVariant, + PlanPhaseAmountDiscountAdjustment >) )] -public sealed record class PlanPhaseAmountDiscountAdjustment( - Models::PlanPhaseAmountDiscountAdjustment Value +public sealed record class PlanPhaseAmountDiscountAdjustmentVariant( + PlanPhaseAmountDiscountAdjustment Value ) - : AdjustmentIntervalProperties::Adjustment, - Orb::IVariant + : Adjustment, + IVariant { - public static PlanPhaseAmountDiscountAdjustment From( - Models::PlanPhaseAmountDiscountAdjustment value + public static PlanPhaseAmountDiscountAdjustmentVariant From( + PlanPhaseAmountDiscountAdjustment value ) { return new(value); @@ -55,23 +50,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhasePercentageDiscountAdjustment, - Models::PlanPhasePercentageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhasePercentageDiscountAdjustmentVariant, + PlanPhasePercentageDiscountAdjustment >) )] -public sealed record class PlanPhasePercentageDiscountAdjustment( - Models::PlanPhasePercentageDiscountAdjustment Value +public sealed record class PlanPhasePercentageDiscountAdjustmentVariant( + PlanPhasePercentageDiscountAdjustment Value ) - : AdjustmentIntervalProperties::Adjustment, - Orb::IVariant< - PlanPhasePercentageDiscountAdjustment, - Models::PlanPhasePercentageDiscountAdjustment + : Adjustment, + IVariant< + PlanPhasePercentageDiscountAdjustmentVariant, + PlanPhasePercentageDiscountAdjustment > { - public static PlanPhasePercentageDiscountAdjustment From( - Models::PlanPhasePercentageDiscountAdjustment value + public static PlanPhasePercentageDiscountAdjustmentVariant From( + PlanPhasePercentageDiscountAdjustment value ) { return new(value); @@ -83,14 +78,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PlanPhaseMinimumAdjustment(Models::PlanPhaseMinimumAdjustment Value) - : AdjustmentIntervalProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseMinimumAdjustmentVariant(PlanPhaseMinimumAdjustment Value) + : Adjustment, + IVariant { - public static PlanPhaseMinimumAdjustment From(Models::PlanPhaseMinimumAdjustment value) + public static PlanPhaseMinimumAdjustmentVariant From(PlanPhaseMinimumAdjustment value) { return new(value); } @@ -101,14 +96,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PlanPhaseMaximumAdjustment(Models::PlanPhaseMaximumAdjustment Value) - : AdjustmentIntervalProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseMaximumAdjustmentVariant(PlanPhaseMaximumAdjustment Value) + : Adjustment, + IVariant { - public static PlanPhaseMaximumAdjustment From(Models::PlanPhaseMaximumAdjustment value) + public static PlanPhaseMaximumAdjustmentVariant From(PlanPhaseMaximumAdjustment value) { return new(value); } diff --git a/src/Orb/Models/AggregatedCost.cs b/src/Orb/Models/AggregatedCost.cs index f44aca74..8bd87cbe 100644 --- a/src/Orb/Models/AggregatedCost.cs +++ b/src/Orb/Models/AggregatedCost.cs @@ -1,29 +1,28 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AggregatedCost : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AggregatedCost : ModelBase, IFromRaw { - public required Generic::List PerPriceCosts + public required List PerPriceCosts { get { - if (!this.Properties.TryGetValue("per_price_costs", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_price_costs", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "per_price_costs", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("per_price_costs"); } - set { this.Properties["per_price_costs"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["per_price_costs"] = JsonSerializer.SerializeToElement(value); } } /// @@ -33,46 +32,46 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_end", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -82,13 +81,13 @@ public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -106,16 +105,14 @@ public override void Validate() public AggregatedCost() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AggregatedCost(Generic::Dictionary properties) + [SetsRequiredMembers] + AggregatedCost(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AggregatedCost FromRawUnchecked( - Generic::Dictionary properties - ) + public static AggregatedCost FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Alerts/Alert.cs b/src/Orb/Models/Alerts/Alert.cs index 9f822b2f..c8acc8bf 100644 --- a/src/Orb/Models/Alerts/Alert.cs +++ b/src/Orb/Models/Alerts/Alert.cs @@ -1,10 +1,8 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AlertProperties = Orb.Models.Alerts.AlertProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts; @@ -15,8 +13,8 @@ namespace Orb.Models.Alerts; /// /// Alerts created through the API can be scoped to either customers or subscriptions. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Alert : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Alert : ModelBase, IFromRaw { /// /// Also referred to as alert_id in this documentation. @@ -25,13 +23,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,15 +39,15 @@ public required string ID { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +57,33 @@ public required string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// The customer the alert applies to. /// - public required Models::CustomerMinified? Customer + public required CustomerMinified? Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,15 +93,15 @@ public required bool Enabled { get { - if (!this.Properties.TryGetValue("enabled", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("enabled", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "enabled", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["enabled"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["enabled"] = JsonSerializer.SerializeToElement(value); } } /// @@ -113,15 +111,15 @@ public required bool Enabled { get { - if (!this.Properties.TryGetValue("metric", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metric", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metric"] = JsonSerializer.SerializeToElement(value); } } /// @@ -131,48 +129,48 @@ public required bool Enabled { get { - if (!this.Properties.TryGetValue("plan", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan", out JsonElement element)) throw new System::ArgumentOutOfRangeException("plan", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["plan"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan"] = JsonSerializer.SerializeToElement(value); } } /// /// The subscription the alert applies to. /// - public required Models::SubscriptionMinified? Subscription + public required SubscriptionMinified? Subscription { get { - if (!this.Properties.TryGetValue("subscription", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subscription", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subscription", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["subscription"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); } } /// /// The thresholds that define the conditions under which the alert will be triggered. /// - public required Generic::List? Thresholds + public required List? Thresholds { get { - if (!this.Properties.TryGetValue("thresholds", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("thresholds", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "thresholds", "Missing required argument" ); - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["thresholds"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["thresholds"] = JsonSerializer.SerializeToElement(value); } } /// @@ -182,35 +180,28 @@ public required bool Enabled { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } /// /// The current status of the alert. This field is only present for credit balance alerts. /// - public Generic::List? BalanceAlertStatus + public List? BalanceAlertStatus { get { - if (!this.Properties.TryGetValue("balance_alert_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("balance_alert_status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); - } - set - { - this.Properties["balance_alert_status"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["balance_alert_status"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -237,14 +228,14 @@ public override void Validate() public Alert() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Alert(Generic::Dictionary properties) + [SetsRequiredMembers] + Alert(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Alert FromRawUnchecked(Generic::Dictionary properties) + public static Alert FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Alerts/AlertCreateForCustomerParams.cs b/src/Orb/Models/Alerts/AlertCreateForCustomerParams.cs index be9efe1b..a821a745 100644 --- a/src/Orb/Models/Alerts/AlertCreateForCustomerParams.cs +++ b/src/Orb/Models/Alerts/AlertCreateForCustomerParams.cs @@ -1,10 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using AlertCreateForCustomerParamsProperties = Orb.Models.Alerts.AlertCreateForCustomerParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Alerts; @@ -16,9 +15,9 @@ namespace Orb.Models.Alerts; /// `credit_balance_dropped` alerts require a list of thresholds to be provided while /// `credit_balance_depleted` and `credit_balance_recovered` alerts do not require thresholds. /// -public sealed record class AlertCreateForCustomerParams : Orb::ParamsBase +public sealed record class AlertCreateForCustomerParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string CustomerID; @@ -29,16 +28,16 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -48,32 +47,31 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("type", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("type"); } - set { this.BodyProperties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); } } /// /// The thresholds that define the values at which the alert will be triggered. /// - public Generic::List? Thresholds + public List? Thresholds { get { - if (!this.BodyProperties.TryGetValue("thresholds", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("thresholds", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["thresholds"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -84,21 +82,21 @@ public required string Currency }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertCreateForCustomerParamsProperties/Type.cs b/src/Orb/Models/Alerts/AlertCreateForCustomerParamsProperties/Type.cs index 9509643a..432ed20b 100644 --- a/src/Orb/Models/Alerts/AlertCreateForCustomerParamsProperties/Type.cs +++ b/src/Orb/Models/Alerts/AlertCreateForCustomerParamsProperties/Type.cs @@ -1,5 +1,4 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertCreateForCustomerParamsProperties; @@ -7,8 +6,8 @@ namespace Orb.Models.Alerts.AlertCreateForCustomerParamsProperties; /// /// The type of alert to create. This must be a valid alert type. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type CreditBalanceDepleted = new("credit_balance_depleted"); diff --git a/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParams.cs b/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParams.cs index 2c140857..5ed23c1a 100644 --- a/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParams.cs +++ b/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParams.cs @@ -1,10 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using AlertCreateForExternalCustomerParamsProperties = Orb.Models.Alerts.AlertCreateForExternalCustomerParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Alerts; @@ -16,9 +15,9 @@ namespace Orb.Models.Alerts; /// `credit_balance_dropped` alerts require a list of thresholds to be provided while /// `credit_balance_depleted` and `credit_balance_recovered` alerts do not require thresholds. /// -public sealed record class AlertCreateForExternalCustomerParams : Orb::ParamsBase +public sealed record class AlertCreateForExternalCustomerParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ExternalCustomerID; @@ -29,16 +28,16 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -48,32 +47,32 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("type", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("type"); } - set { this.BodyProperties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); } } /// /// The thresholds that define the values at which the alert will be triggered. /// - public Generic::List? Thresholds + public List? Thresholds { get { - if (!this.BodyProperties.TryGetValue("thresholds", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("thresholds", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["thresholds"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -84,21 +83,21 @@ public required string Currency }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParamsProperties/Type.cs b/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParamsProperties/Type.cs index b5060f3e..f318c43b 100644 --- a/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParamsProperties/Type.cs +++ b/src/Orb/Models/Alerts/AlertCreateForExternalCustomerParamsProperties/Type.cs @@ -1,5 +1,4 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertCreateForExternalCustomerParamsProperties; @@ -7,8 +6,8 @@ namespace Orb.Models.Alerts.AlertCreateForExternalCustomerParamsProperties; /// /// The type of alert to create. This must be a valid alert type. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type CreditBalanceDepleted = new("credit_balance_depleted"); diff --git a/src/Orb/Models/Alerts/AlertCreateForSubscriptionParams.cs b/src/Orb/Models/Alerts/AlertCreateForSubscriptionParams.cs index 85a401b1..30e5866e 100644 --- a/src/Orb/Models/Alerts/AlertCreateForSubscriptionParams.cs +++ b/src/Orb/Models/Alerts/AlertCreateForSubscriptionParams.cs @@ -1,10 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using AlertCreateForSubscriptionParamsProperties = Orb.Models.Alerts.AlertCreateForSubscriptionParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Alerts; @@ -21,29 +20,29 @@ namespace Orb.Models.Alerts; /// of the subscription. Alerts are triggered based on usage or cost conditions met /// during the current billing cycle. /// -public sealed record class AlertCreateForSubscriptionParams : Orb::ParamsBase +public sealed record class AlertCreateForSubscriptionParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; /// /// The thresholds that define the values at which the alert will be triggered. /// - public required Generic::List Thresholds + public required List Thresholds { get { - if (!this.BodyProperties.TryGetValue("thresholds", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("thresholds", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "thresholds", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("thresholds"); } - set { this.BodyProperties["thresholds"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,14 +52,14 @@ public sealed record class AlertCreateForSubscriptionParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("type", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("type"); } - set { this.BodyProperties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -70,15 +69,15 @@ public string? MetricID { get { - if (!this.BodyProperties.TryGetValue("metric_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["metric_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metric_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -89,21 +88,21 @@ public string? MetricID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertCreateForSubscriptionParamsProperties/Type.cs b/src/Orb/Models/Alerts/AlertCreateForSubscriptionParamsProperties/Type.cs index f231d73b..cd499ebf 100644 --- a/src/Orb/Models/Alerts/AlertCreateForSubscriptionParamsProperties/Type.cs +++ b/src/Orb/Models/Alerts/AlertCreateForSubscriptionParamsProperties/Type.cs @@ -1,5 +1,4 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertCreateForSubscriptionParamsProperties; @@ -7,8 +6,8 @@ namespace Orb.Models.Alerts.AlertCreateForSubscriptionParamsProperties; /// /// The type of alert to create. This must be a valid alert type. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type UsageExceeded = new("usage_exceeded"); diff --git a/src/Orb/Models/Alerts/AlertDisableParams.cs b/src/Orb/Models/Alerts/AlertDisableParams.cs index d8be8973..233fa987 100644 --- a/src/Orb/Models/Alerts/AlertDisableParams.cs +++ b/src/Orb/Models/Alerts/AlertDisableParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Alerts; @@ -10,7 +9,7 @@ namespace Orb.Models.Alerts; /// a specific subscription, you must include the `subscription_id`. The `subscription_id` /// is not required for customer or subscription level alerts. /// -public sealed record class AlertDisableParams : Orb::ParamsBase +public sealed record class AlertDisableParams : ParamsBase { public required string AlertConfigurationID; @@ -21,20 +20,15 @@ public string? SubscriptionID { get { - if (!this.QueryProperties.TryGetValue("subscription_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("subscription_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["subscription_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["subscription_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -45,12 +39,12 @@ public string? SubscriptionID }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertEnableParams.cs b/src/Orb/Models/Alerts/AlertEnableParams.cs index 5278202b..9ea88697 100644 --- a/src/Orb/Models/Alerts/AlertEnableParams.cs +++ b/src/Orb/Models/Alerts/AlertEnableParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Alerts; @@ -10,7 +9,7 @@ namespace Orb.Models.Alerts; /// a specific subscription, you must include the `subscription_id`. The `subscription_id` /// is not required for customer or subscription level alerts. /// -public sealed record class AlertEnableParams : Orb::ParamsBase +public sealed record class AlertEnableParams : ParamsBase { public required string AlertConfigurationID; @@ -21,20 +20,15 @@ public string? SubscriptionID { get { - if (!this.QueryProperties.TryGetValue("subscription_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("subscription_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["subscription_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["subscription_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -45,12 +39,12 @@ public string? SubscriptionID }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertListPageResponse.cs b/src/Orb/Models/Alerts/AlertListPageResponse.cs index c4f94958..e0385e65 100644 --- a/src/Orb/Models/Alerts/AlertListPageResponse.cs +++ b/src/Orb/Models/Alerts/AlertListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AlertListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AlertListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +51,14 @@ public override void Validate() public AlertListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AlertListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + AlertListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AlertListPageResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static AlertListPageResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Alerts/AlertListParams.cs b/src/Orb/Models/Alerts/AlertListParams.cs index bbb8d286..fd6d555b 100644 --- a/src/Orb/Models/Alerts/AlertListParams.cs +++ b/src/Orb/Models/Alerts/AlertListParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Alerts; @@ -16,70 +15,54 @@ namespace Orb.Models.Alerts; /// The list of alerts is ordered starting from the most recently created alert. /// This endpoint follows Orb's [standardized pagination format](/api-reference/pagination). /// -public sealed record class AlertListParams : Orb::ParamsBase +public sealed record class AlertListParams : ParamsBase { public System::DateTime? CreatedAtGt { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +73,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,15 +88,12 @@ public string? CustomerID { get { - if (!this.QueryProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -123,21 +103,14 @@ public string? ExternalCustomerID { get { - if ( - !this.QueryProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -148,12 +121,12 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } /// @@ -163,20 +136,15 @@ public string? SubscriptionID { get { - if (!this.QueryProperties.TryGetValue("subscription_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("subscription_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["subscription_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["subscription_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/alerts") { @@ -184,12 +152,12 @@ public string? SubscriptionID }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertProperties/BalanceAlertStatus.cs b/src/Orb/Models/Alerts/AlertProperties/BalanceAlertStatus.cs index 3715045e..addf93c7 100644 --- a/src/Orb/Models/Alerts/AlertProperties/BalanceAlertStatus.cs +++ b/src/Orb/Models/Alerts/AlertProperties/BalanceAlertStatus.cs @@ -1,8 +1,7 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertProperties; @@ -10,8 +9,8 @@ namespace Orb.Models.Alerts.AlertProperties; /// /// Alert status is used to determine if an alert is currently in-alert or not. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BalanceAlertStatus : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BalanceAlertStatus : ModelBase, IFromRaw { /// /// Whether the alert is currently in-alert or not. @@ -20,15 +19,15 @@ public required bool InAlert { get { - if (!this.Properties.TryGetValue("in_alert", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("in_alert", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "in_alert", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["in_alert"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["in_alert"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,15 +37,15 @@ public required double ThresholdValue { get { - if (!this.Properties.TryGetValue("threshold_value", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("threshold_value", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "threshold_value", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["threshold_value"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["threshold_value"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -58,16 +57,14 @@ public override void Validate() public BalanceAlertStatus() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BalanceAlertStatus(Generic::Dictionary properties) + [SetsRequiredMembers] + BalanceAlertStatus(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BalanceAlertStatus FromRawUnchecked( - Generic::Dictionary properties - ) + public static BalanceAlertStatus FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Alerts/AlertProperties/Metric.cs b/src/Orb/Models/Alerts/AlertProperties/Metric.cs index 1ed6a70f..1f0fcf73 100644 --- a/src/Orb/Models/Alerts/AlertProperties/Metric.cs +++ b/src/Orb/Models/Alerts/AlertProperties/Metric.cs @@ -1,8 +1,7 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertProperties; @@ -10,20 +9,20 @@ namespace Orb.Models.Alerts.AlertProperties; /// /// The metric the alert applies to. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Metric : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Metric : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -34,14 +33,14 @@ public override void Validate() public Metric() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Metric(Generic::Dictionary properties) + [SetsRequiredMembers] + Metric(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Metric FromRawUnchecked(Generic::Dictionary properties) + public static Metric FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Alerts/AlertProperties/Plan.cs b/src/Orb/Models/Alerts/AlertProperties/Plan.cs index 859ec429..b02f49b1 100644 --- a/src/Orb/Models/Alerts/AlertProperties/Plan.cs +++ b/src/Orb/Models/Alerts/AlertProperties/Plan.cs @@ -1,8 +1,7 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertProperties; @@ -10,19 +9,19 @@ namespace Orb.Models.Alerts.AlertProperties; /// /// The plan the alert applies to. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Plan : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Plan : ModelBase, IFromRaw { public required string? ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,46 +33,43 @@ public required string? ExternalPlanID { get { - if (!this.Properties.TryGetValue("external_plan_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_plan_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "external_plan_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_plan_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } public required string? Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required string PlanVersion { get { - if (!this.Properties.TryGetValue("plan_version", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_version", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "plan_version", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("plan_version"); } - set { this.Properties["plan_version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan_version"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -87,14 +83,14 @@ public override void Validate() public Plan() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Plan(Generic::Dictionary properties) + [SetsRequiredMembers] + Plan(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Plan FromRawUnchecked(Generic::Dictionary properties) + public static Plan FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Alerts/AlertProperties/Type.cs b/src/Orb/Models/Alerts/AlertProperties/Type.cs index b272650f..5fec60d5 100644 --- a/src/Orb/Models/Alerts/AlertProperties/Type.cs +++ b/src/Orb/Models/Alerts/AlertProperties/Type.cs @@ -1,5 +1,4 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts.AlertProperties; @@ -7,8 +6,8 @@ namespace Orb.Models.Alerts.AlertProperties; /// /// The type of alert. This must be a valid alert type. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type CreditBalanceDepleted = new("credit_balance_depleted"); diff --git a/src/Orb/Models/Alerts/AlertRetrieveParams.cs b/src/Orb/Models/Alerts/AlertRetrieveParams.cs index 9f755da5..0e4c3565 100644 --- a/src/Orb/Models/Alerts/AlertRetrieveParams.cs +++ b/src/Orb/Models/Alerts/AlertRetrieveParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Alerts; @@ -7,11 +6,11 @@ namespace Orb.Models.Alerts; /// /// This endpoint retrieves an alert by its ID. /// -public sealed record class AlertRetrieveParams : Orb::ParamsBase +public sealed record class AlertRetrieveParams : ParamsBase { public required string AlertID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/alerts/{0}", this.AlertID) @@ -21,12 +20,12 @@ public sealed record class AlertRetrieveParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/AlertUpdateParams.cs b/src/Orb/Models/Alerts/AlertUpdateParams.cs index 596a12ac..38392f46 100644 --- a/src/Orb/Models/Alerts/AlertUpdateParams.cs +++ b/src/Orb/Models/Alerts/AlertUpdateParams.cs @@ -1,41 +1,40 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Alerts; /// /// This endpoint updates the thresholds of an alert. /// -public sealed record class AlertUpdateParams : Orb::ParamsBase +public sealed record class AlertUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string AlertConfigurationID; /// /// The thresholds that define the values at which the alert will be triggered. /// - public required Generic::List Thresholds + public required List Thresholds { get { - if (!this.BodyProperties.TryGetValue("thresholds", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("thresholds", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "thresholds", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("thresholds"); } - set { this.BodyProperties["thresholds"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -46,21 +45,21 @@ public sealed record class AlertUpdateParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Alerts/Threshold.cs b/src/Orb/Models/Alerts/Threshold.cs index 7fcd76b6..a6070cba 100644 --- a/src/Orb/Models/Alerts/Threshold.cs +++ b/src/Orb/Models/Alerts/Threshold.cs @@ -1,8 +1,7 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Alerts; @@ -10,8 +9,8 @@ namespace Orb.Models.Alerts; /// /// Thresholds are used to define the conditions under which an alert will be triggered. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Threshold : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Threshold : ModelBase, IFromRaw { /// /// The value at which an alert will fire. For credit balance alerts, the alert @@ -22,12 +21,12 @@ public required double Value { get { - if (!this.Properties.TryGetValue("value", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("value", out JsonElement element)) throw new System::ArgumentOutOfRangeException("value", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["value"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["value"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -38,16 +37,14 @@ public override void Validate() public Threshold() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Threshold(Generic::Dictionary properties) + [SetsRequiredMembers] + Threshold(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Threshold FromRawUnchecked( - Generic::Dictionary properties - ) + public static Threshold FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Allocation.cs b/src/Orb/Models/Allocation.cs index 2db38d3b..21fcc6dd 100644 --- a/src/Orb/Models/Allocation.cs +++ b/src/Orb/Models/Allocation.cs @@ -1,62 +1,58 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Allocation : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Allocation : ModelBase, IFromRaw { public required bool AllowsRollover { get { - if (!this.Properties.TryGetValue("allows_rollover", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allows_rollover", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "allows_rollover", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["allows_rollover"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["allows_rollover"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } public required CustomExpiration? CustomExpiration { get { - if (!this.Properties.TryGetValue("custom_expiration", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("custom_expiration", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "custom_expiration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["custom_expiration"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["custom_expiration"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -69,16 +65,14 @@ public override void Validate() public Allocation() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Allocation(Generic::Dictionary properties) + [SetsRequiredMembers] + Allocation(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Allocation FromRawUnchecked( - Generic::Dictionary properties - ) + public static Allocation FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/AmountDiscount.cs b/src/Orb/Models/AmountDiscount.cs index 3910b904..4c48361e 100644 --- a/src/Orb/Models/AmountDiscount.cs +++ b/src/Orb/Models/AmountDiscount.cs @@ -1,15 +1,14 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AmountDiscountProperties = Orb.Models.AmountDiscountProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AmountDiscount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AmountDiscount : ModelBase, IFromRaw { /// /// Only available if discount_type is `amount`. @@ -18,80 +17,75 @@ public required string AmountDiscount1 { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_discount"); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } public required AmountDiscountProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// /// List of price_ids that this discount applies to. For plan/plan phase discounts, /// this can be a subset of prices. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this discount to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -112,16 +106,14 @@ public override void Validate() public AmountDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AmountDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + AmountDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AmountDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static AmountDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/AmountDiscountInterval.cs b/src/Orb/Models/AmountDiscountInterval.cs index e0ab4325..3d126a9c 100644 --- a/src/Orb/Models/AmountDiscountInterval.cs +++ b/src/Orb/Models/AmountDiscountInterval.cs @@ -1,17 +1,14 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AmountDiscountIntervalProperties = Orb.Models.AmountDiscountIntervalProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AmountDiscountInterval - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AmountDiscountInterval : ModelBase, IFromRaw { /// /// Only available if discount_type is `amount`. @@ -20,29 +17,29 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_discount"); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price interval ids that this discount interval applies to. /// - public required Generic::List AppliesToPriceIntervalIDs + public required List AppliesToPriceIntervalIDs { get { if ( !this.Properties.TryGetValue( "applies_to_price_interval_ids", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -50,13 +47,14 @@ public required string AmountDiscount "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_interval_ids"); } set { - this.Properties["applies_to_price_interval_ids"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -64,17 +62,17 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -84,34 +82,34 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices this discount interval applies to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +119,15 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -151,15 +149,15 @@ public override void Validate() public AmountDiscountInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AmountDiscountInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + AmountDiscountInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static AmountDiscountInterval FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/AmountDiscountIntervalProperties/DiscountType.cs b/src/Orb/Models/AmountDiscountIntervalProperties/DiscountType.cs index 65601168..237ed840 100644 --- a/src/Orb/Models/AmountDiscountIntervalProperties/DiscountType.cs +++ b/src/Orb/Models/AmountDiscountIntervalProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.AmountDiscountIntervalProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Amount = new("amount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "amount" => Value.Amount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/AmountDiscountProperties/DiscountType.cs b/src/Orb/Models/AmountDiscountProperties/DiscountType.cs index ed2b3e6c..4bd5b568 100644 --- a/src/Orb/Models/AmountDiscountProperties/DiscountType.cs +++ b/src/Orb/Models/AmountDiscountProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.AmountDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Amount = new("amount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "amount" => Value.Amount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/BPSConfig.cs b/src/Orb/Models/BPSConfig.cs index ce163f48..c03a2381 100644 --- a/src/Orb/Models/BPSConfig.cs +++ b/src/Orb/Models/BPSConfig.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BPSConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BPSConfig : ModelBase, IFromRaw { /// /// Basis point take rate per event @@ -17,12 +16,12 @@ public required double BPS { get { - if (!this.Properties.TryGetValue("bps", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bps", out JsonElement element)) throw new System::ArgumentOutOfRangeException("bps", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["bps"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps"] = JsonSerializer.SerializeToElement(value); } } /// @@ -32,15 +31,12 @@ public string? PerUnitMaximum { get { - if (!this.Properties.TryGetValue("per_unit_maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_unit_maximum", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_maximum"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_maximum"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -52,16 +48,14 @@ public override void Validate() public BPSConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BPSConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + BPSConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BPSConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static BPSConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/BPSTier.cs b/src/Orb/Models/BPSTier.cs index d9707ff5..2374a975 100644 --- a/src/Orb/Models/BPSTier.cs +++ b/src/Orb/Models/BPSTier.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BPSTier : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BPSTier : ModelBase, IFromRaw { /// /// Per-event basis point rate @@ -17,12 +16,12 @@ public required double BPS { get { - if (!this.Properties.TryGetValue("bps", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bps", out JsonElement element)) throw new System::ArgumentOutOfRangeException("bps", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["bps"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps"] = JsonSerializer.SerializeToElement(value); } } /// @@ -32,16 +31,16 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("minimum_amount"); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -51,12 +50,12 @@ public string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -66,15 +65,12 @@ public string? PerUnitMaximum { get { - if (!this.Properties.TryGetValue("per_unit_maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_unit_maximum", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_maximum"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_maximum"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -88,16 +84,14 @@ public override void Validate() public BPSTier() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BPSTier(Generic::Dictionary properties) + [SetsRequiredMembers] + BPSTier(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BPSTier FromRawUnchecked( - Generic::Dictionary properties - ) + public static BPSTier FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParams.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParams.cs index 8652a016..b2b7871d 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParams.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParams.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using BetaCreatePlanVersionParamsProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; namespace Orb.Models.Beta; @@ -14,9 +13,9 @@ namespace Orb.Models.Beta; /// /// This endpoint allows the creation of a new plan version for an existing plan. /// -public sealed record class BetaCreatePlanVersionParams : Orb::ParamsBase +public sealed record class BetaCreatePlanVersionParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string PlanID; @@ -27,146 +26,120 @@ public required long Version { get { - if (!this.BodyProperties.TryGetValue("version", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "version", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("version", out JsonElement element)) + throw new ArgumentOutOfRangeException("version", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["version"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional adjustments to be added to the plan. /// - public Generic::List? AddAdjustments + public List? AddAdjustments { get { - if (!this.BodyProperties.TryGetValue("add_adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["add_adjustments"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["add_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional prices to be added to the plan. /// - public Generic::List? AddPrices + public List? AddPrices { get { - if (!this.BodyProperties.TryGetValue("add_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["add_prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["add_prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Adjustments to be removed from the plan. /// - public Generic::List? RemoveAdjustments + public List? RemoveAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "remove_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("remove_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["remove_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["remove_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices to be removed from the plan. /// - public Generic::List? RemovePrices + public List? RemovePrices { get { - if (!this.BodyProperties.TryGetValue("remove_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("remove_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["remove_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["remove_prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Adjustments to be replaced with additional adjustments on the plan. /// - public Generic::List? ReplaceAdjustments + public List? ReplaceAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "replace_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("replace_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["replace_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["replace_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices to be replaced with additional prices on the plan. /// - public Generic::List? ReplacePrices + public List? ReplacePrices { get { - if (!this.BodyProperties.TryGetValue("replace_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("replace_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["replace_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["replace_prices"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,20 +149,17 @@ public bool? SetAsDefault { get { - if (!this.BodyProperties.TryGetValue("set_as_default", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("set_as_default", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["set_as_default"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["set_as_default"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/{0}/versions", this.PlanID) ) @@ -198,21 +168,21 @@ public bool? SetAsDefault }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustment.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustment.cs index 66953216..273ad974 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustment.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustment.cs @@ -1,15 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddAdjustmentProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddAdjustmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the plan. @@ -18,16 +17,13 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element) - ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +33,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +50,14 @@ public override void Validate() public AddAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + AddAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs index b5dcbf0c..5cf1965a 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the plan. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs index d2905a64..3bc2cdf5 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using AddAdjustmentProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPrice.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPrice.cs index 01aaf8b2..ce45eeb4 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPrice.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPrice.cs @@ -1,32 +1,27 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddPriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddPrice : ModelBase, IFromRaw { /// /// The allocation price to add to the plan. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,30 +31,27 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// /// The price to add to the plan /// - public AddPriceProperties::Price? Price + public AddPriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -72,16 +64,14 @@ public override void Validate() public AddPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + AddPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs deleted file mode 100644 index 401cec51..00000000 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties; - -/// -/// The price to add to the plan -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewPlanUnitPrice Create(Models::NewPlanUnitPrice value) => - new(value); - - public static PriceVariants::NewPlanPackagePrice Create(Models::NewPlanPackagePrice value) => - new(value); - - public static PriceVariants::NewPlanMatrixPrice Create(Models::NewPlanMatrixPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredPrice Create(Models::NewPlanTieredPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredBPSPrice Create( - Models::NewPlanTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewPlanBPSPrice Create(Models::NewPlanBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkBPSPrice Create(Models::NewPlanBulkBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkPrice Create(Models::NewPlanBulkPrice value) => - new(value); - - public static PriceVariants::NewPlanThresholdTotalAmountPrice Create( - Models::NewPlanThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackagePrice Create( - Models::NewPlanTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredWithMinimumPrice Create( - Models::NewPlanTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithPercentPrice Create( - Models::NewPlanUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewPlanPackageWithAllocationPrice Create( - Models::NewPlanPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanTierWithProrationPrice Create( - Models::NewPlanTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithProrationPrice Create( - Models::NewPlanUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedAllocationPrice Create( - Models::NewPlanGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithProratedMinimumPrice Create( - Models::NewPlanGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithMeteredMinimumPrice Create( - Models::NewPlanGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithDisplayNamePrice Create( - Models::NewPlanMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewPlanBulkWithProrationPrice Create( - Models::NewPlanBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPackagePrice Create( - Models::NewPlanGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanMaxGroupTieredPackagePrice Create( - Models::NewPlanMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithUnitPricingPrice Create( - Models::NewPlanScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithTieredPricingPrice Create( - Models::NewPlanScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanCumulativeGroupedBulkPrice Create( - Models::NewPlanCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackageWithMinimumPrice Create( - Models::NewPlanTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithAllocationPrice Create( - Models::NewPlanMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPrice Create( - Models::NewPlanGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price1.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price1.cs new file mode 100644 index 00000000..8cbbfa7f --- /dev/null +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price1.cs @@ -0,0 +1,99 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants; + +namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties; + +/// +/// The price to add to the plan +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewPlanUnitPrice value) => + new PriceVariants::NewPlanUnitPriceVariant(value); + + public static implicit operator Price1(NewPlanPackagePrice value) => + new PriceVariants::NewPlanPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixPrice value) => + new PriceVariants::NewPlanMatrixPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPrice value) => + new PriceVariants::NewPlanTieredPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredBPSPrice value) => + new PriceVariants::NewPlanTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBPSPrice value) => + new PriceVariants::NewPlanBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkBPSPrice value) => + new PriceVariants::NewPlanBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkPrice value) => + new PriceVariants::NewPlanBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanThresholdTotalAmountPrice value) => + new PriceVariants::NewPlanThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackagePrice value) => + new PriceVariants::NewPlanTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanTieredWithMinimumPrice value) => + new PriceVariants::NewPlanTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithPercentPrice value) => + new PriceVariants::NewPlanUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewPlanPackageWithAllocationPrice value) => + new PriceVariants::NewPlanPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanTierWithProrationPrice value) => + new PriceVariants::NewPlanTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithProrationPrice value) => + new PriceVariants::NewPlanUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedAllocationPrice value) => + new PriceVariants::NewPlanGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithDisplayNamePrice value) => + new PriceVariants::NewPlanMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewPlanBulkWithProrationPrice value) => + new PriceVariants::NewPlanBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPackagePrice value) => + new PriceVariants::NewPlanGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMaxGroupTieredPackagePrice value) => + new PriceVariants::NewPlanMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanCumulativeGroupedBulkPrice value) => + new PriceVariants::NewPlanCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackageWithMinimumPrice value) => + new PriceVariants::NewPlanTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithAllocationPrice value) => + new PriceVariants::NewPlanMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPrice value) => + new PriceVariants::NewPlanGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs index eec0251e..33197741 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using AddPriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanUnitPrice(Models::NewPlanUnitPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanUnitPriceVariant(NewPlanUnitPrice Value) + : Price1, + IVariant { - public static NewPlanUnitPrice From(Models::NewPlanUnitPrice value) + public static NewPlanUnitPriceVariant From(NewPlanUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanPackagePrice(Models::NewPlanPackagePrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanPackagePriceVariant(NewPlanPackagePrice Value) + : Price1, + IVariant { - public static NewPlanPackagePrice From(Models::NewPlanPackagePrice value) + public static NewPlanPackagePriceVariant From(NewPlanPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanMatrixPrice(Models::NewPlanMatrixPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanMatrixPriceVariant(NewPlanMatrixPrice Value) + : Price1, + IVariant { - public static NewPlanMatrixPrice From(Models::NewPlanMatrixPrice value) + public static NewPlanMatrixPriceVariant From(NewPlanMatrixPrice value) { return new(value); } @@ -59,14 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredPrice(Models::NewPlanTieredPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredPriceVariant(NewPlanTieredPrice Value) + : Price1, + IVariant { - public static NewPlanTieredPrice From(Models::NewPlanTieredPrice value) + public static NewPlanTieredPriceVariant From(NewPlanTieredPrice value) { return new(value); } @@ -77,14 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredBPSPrice(Models::NewPlanTieredBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredBPSPriceVariant(NewPlanTieredBPSPrice Value) + : Price1, + IVariant { - public static NewPlanTieredBPSPrice From(Models::NewPlanTieredBPSPrice value) + public static NewPlanTieredBPSPriceVariant From(NewPlanTieredBPSPrice value) { return new(value); } @@ -95,14 +82,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBPSPrice(Models::NewPlanBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBPSPriceVariant(NewPlanBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBPSPrice From(Models::NewPlanBPSPrice value) + public static NewPlanBPSPriceVariant From(NewPlanBPSPrice value) { return new(value); } @@ -113,14 +98,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkBPSPrice(Models::NewPlanBulkBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkBPSPriceVariant(NewPlanBulkBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBulkBPSPrice From(Models::NewPlanBulkBPSPrice value) + public static NewPlanBulkBPSPriceVariant From(NewPlanBulkBPSPrice value) { return new(value); } @@ -131,14 +114,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkPrice(Models::NewPlanBulkPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkPriceVariant(NewPlanBulkPrice Value) + : Price1, + IVariant { - public static NewPlanBulkPrice From(Models::NewPlanBulkPrice value) + public static NewPlanBulkPriceVariant From(NewPlanBulkPrice value) { return new(value); } @@ -149,20 +130,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanThresholdTotalAmountPrice, - Models::NewPlanThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanThresholdTotalAmountPriceVariant, + NewPlanThresholdTotalAmountPrice >) )] -public sealed record class NewPlanThresholdTotalAmountPrice( - Models::NewPlanThresholdTotalAmountPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanThresholdTotalAmountPriceVariant( + NewPlanThresholdTotalAmountPrice Value +) : Price1, IVariant { - public static NewPlanThresholdTotalAmountPrice From( - Models::NewPlanThresholdTotalAmountPrice value + public static NewPlanThresholdTotalAmountPriceVariant From( + NewPlanThresholdTotalAmountPrice value ) { return new(value); @@ -174,14 +153,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredPackagePrice(Models::NewPlanTieredPackagePrice Value) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredPackagePriceVariant(NewPlanTieredPackagePrice Value) + : Price1, + IVariant { - public static NewPlanTieredPackagePrice From(Models::NewPlanTieredPackagePrice value) + public static NewPlanTieredPackagePriceVariant From(NewPlanTieredPackagePrice value) { return new(value); } @@ -192,19 +171,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredWithMinimumPrice, - Models::NewPlanTieredWithMinimumPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredWithMinimumPrice( - Models::NewPlanTieredWithMinimumPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredWithMinimumPriceVariant(NewPlanTieredWithMinimumPrice Value) + : Price1, + IVariant { - public static NewPlanTieredWithMinimumPrice From(Models::NewPlanTieredWithMinimumPrice value) + public static NewPlanTieredWithMinimumPriceVariant From(NewPlanTieredWithMinimumPrice value) { return new(value); } @@ -215,14 +189,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithPercentPrice(Models::NewPlanUnitWithPercentPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithPercentPriceVariant(NewPlanUnitWithPercentPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithPercentPrice From(Models::NewPlanUnitWithPercentPrice value) + public static NewPlanUnitWithPercentPriceVariant From(NewPlanUnitWithPercentPrice value) { return new(value); } @@ -233,20 +207,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanPackageWithAllocationPrice, - Models::NewPlanPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanPackageWithAllocationPriceVariant, + NewPlanPackageWithAllocationPrice >) )] -public sealed record class NewPlanPackageWithAllocationPrice( - Models::NewPlanPackageWithAllocationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanPackageWithAllocationPriceVariant( + NewPlanPackageWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanPackageWithAllocationPrice From( - Models::NewPlanPackageWithAllocationPrice value + public static NewPlanPackageWithAllocationPriceVariant From( + NewPlanPackageWithAllocationPrice value ) { return new(value); @@ -258,19 +230,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTierWithProrationPrice, - Models::NewPlanTierWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTierWithProrationPrice( - Models::NewPlanTierWithProrationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTierWithProrationPriceVariant(NewPlanTierWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanTierWithProrationPrice From(Models::NewPlanTierWithProrationPrice value) + public static NewPlanTierWithProrationPriceVariant From(NewPlanTierWithProrationPrice value) { return new(value); } @@ -281,19 +248,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanUnitWithProrationPrice, - Models::NewPlanUnitWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithProrationPrice( - Models::NewPlanUnitWithProrationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithProrationPriceVariant(NewPlanUnitWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithProrationPrice From(Models::NewPlanUnitWithProrationPrice value) + public static NewPlanUnitWithProrationPriceVariant From(NewPlanUnitWithProrationPrice value) { return new(value); } @@ -304,19 +266,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedAllocationPrice, - Models::NewPlanGroupedAllocationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedAllocationPrice( - Models::NewPlanGroupedAllocationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedAllocationPriceVariant(NewPlanGroupedAllocationPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedAllocationPrice From(Models::NewPlanGroupedAllocationPrice value) + public static NewPlanGroupedAllocationPriceVariant From(NewPlanGroupedAllocationPrice value) { return new(value); } @@ -327,23 +284,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice >) )] -public sealed record class NewPlanGroupedWithProratedMinimumPrice( - Models::NewPlanGroupedWithProratedMinimumPrice Value +public sealed record class NewPlanGroupedWithProratedMinimumPriceVariant( + NewPlanGroupedWithProratedMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice > { - public static NewPlanGroupedWithProratedMinimumPrice From( - Models::NewPlanGroupedWithProratedMinimumPrice value + public static NewPlanGroupedWithProratedMinimumPriceVariant From( + NewPlanGroupedWithProratedMinimumPrice value ) { return new(value); @@ -355,23 +312,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewPlanGroupedWithMeteredMinimumPrice( - Models::NewPlanGroupedWithMeteredMinimumPrice Value +public sealed record class NewPlanGroupedWithMeteredMinimumPriceVariant( + NewPlanGroupedWithMeteredMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice > { - public static NewPlanGroupedWithMeteredMinimumPrice From( - Models::NewPlanGroupedWithMeteredMinimumPrice value + public static NewPlanGroupedWithMeteredMinimumPriceVariant From( + NewPlanGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -383,20 +340,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithDisplayNamePrice, - Models::NewPlanMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithDisplayNamePriceVariant, + NewPlanMatrixWithDisplayNamePrice >) )] -public sealed record class NewPlanMatrixWithDisplayNamePrice( - Models::NewPlanMatrixWithDisplayNamePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithDisplayNamePriceVariant( + NewPlanMatrixWithDisplayNamePrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithDisplayNamePrice From( - Models::NewPlanMatrixWithDisplayNamePrice value + public static NewPlanMatrixWithDisplayNamePriceVariant From( + NewPlanMatrixWithDisplayNamePrice value ) { return new(value); @@ -408,19 +363,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanBulkWithProrationPrice, - Models::NewPlanBulkWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanBulkWithProrationPrice( - Models::NewPlanBulkWithProrationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanBulkWithProrationPriceVariant(NewPlanBulkWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanBulkWithProrationPrice From(Models::NewPlanBulkWithProrationPrice value) + public static NewPlanBulkWithProrationPriceVariant From(NewPlanBulkWithProrationPrice value) { return new(value); } @@ -431,20 +381,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedTieredPackagePrice, - Models::NewPlanGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedTieredPackagePriceVariant, + NewPlanGroupedTieredPackagePrice >) )] -public sealed record class NewPlanGroupedTieredPackagePrice( - Models::NewPlanGroupedTieredPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPackagePriceVariant( + NewPlanGroupedTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanGroupedTieredPackagePrice From( - Models::NewPlanGroupedTieredPackagePrice value + public static NewPlanGroupedTieredPackagePriceVariant From( + NewPlanGroupedTieredPackagePrice value ) { return new(value); @@ -456,20 +404,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMaxGroupTieredPackagePrice, - Models::NewPlanMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMaxGroupTieredPackagePriceVariant, + NewPlanMaxGroupTieredPackagePrice >) )] -public sealed record class NewPlanMaxGroupTieredPackagePrice( - Models::NewPlanMaxGroupTieredPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMaxGroupTieredPackagePriceVariant( + NewPlanMaxGroupTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanMaxGroupTieredPackagePrice From( - Models::NewPlanMaxGroupTieredPackagePrice value + public static NewPlanMaxGroupTieredPackagePriceVariant From( + NewPlanMaxGroupTieredPackagePrice value ) { return new(value); @@ -481,23 +427,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithUnitPricingPrice( - Models::NewPlanScalableMatrixWithUnitPricingPrice Value +public sealed record class NewPlanScalableMatrixWithUnitPricingPriceVariant( + NewPlanScalableMatrixWithUnitPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice > { - public static NewPlanScalableMatrixWithUnitPricingPrice From( - Models::NewPlanScalableMatrixWithUnitPricingPrice value + public static NewPlanScalableMatrixWithUnitPricingPriceVariant From( + NewPlanScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -509,23 +455,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithTieredPricingPrice( - Models::NewPlanScalableMatrixWithTieredPricingPrice Value +public sealed record class NewPlanScalableMatrixWithTieredPricingPriceVariant( + NewPlanScalableMatrixWithTieredPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice > { - public static NewPlanScalableMatrixWithTieredPricingPrice From( - Models::NewPlanScalableMatrixWithTieredPricingPrice value + public static NewPlanScalableMatrixWithTieredPricingPriceVariant From( + NewPlanScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -537,20 +483,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanCumulativeGroupedBulkPrice, - Models::NewPlanCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanCumulativeGroupedBulkPriceVariant, + NewPlanCumulativeGroupedBulkPrice >) )] -public sealed record class NewPlanCumulativeGroupedBulkPrice( - Models::NewPlanCumulativeGroupedBulkPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanCumulativeGroupedBulkPriceVariant( + NewPlanCumulativeGroupedBulkPrice Value +) : Price1, IVariant { - public static NewPlanCumulativeGroupedBulkPrice From( - Models::NewPlanCumulativeGroupedBulkPrice value + public static NewPlanCumulativeGroupedBulkPriceVariant From( + NewPlanCumulativeGroupedBulkPrice value ) { return new(value); @@ -562,23 +506,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanTieredPackageWithMinimumPriceVariant, + NewPlanTieredPackageWithMinimumPrice >) )] -public sealed record class NewPlanTieredPackageWithMinimumPrice( - Models::NewPlanTieredPackageWithMinimumPrice Value +public sealed record class NewPlanTieredPackageWithMinimumPriceVariant( + NewPlanTieredPackageWithMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice - > + : Price1, + IVariant { - public static NewPlanTieredPackageWithMinimumPrice From( - Models::NewPlanTieredPackageWithMinimumPrice value + public static NewPlanTieredPackageWithMinimumPriceVariant From( + NewPlanTieredPackageWithMinimumPrice value ) { return new(value); @@ -590,20 +531,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithAllocationPrice, - Models::NewPlanMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithAllocationPriceVariant, + NewPlanMatrixWithAllocationPrice >) )] -public sealed record class NewPlanMatrixWithAllocationPrice( - Models::NewPlanMatrixWithAllocationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithAllocationPriceVariant( + NewPlanMatrixWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithAllocationPrice From( - Models::NewPlanMatrixWithAllocationPrice value + public static NewPlanMatrixWithAllocationPriceVariant From( + NewPlanMatrixWithAllocationPrice value ) { return new(value); @@ -615,14 +554,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedTieredPrice(Models::NewPlanGroupedTieredPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPriceVariant(NewPlanGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedTieredPrice From(Models::NewPlanGroupedTieredPrice value) + public static NewPlanGroupedTieredPriceVariant From(NewPlanGroupedTieredPrice value) { return new(value); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemoveAdjustment.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemoveAdjustment.cs index a8cb7ba3..3cfab69b 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemoveAdjustment.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemoveAdjustment.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemoveAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemoveAdjustment : ModelBase, IFromRaw { /// /// The id of the adjustment to remove from on the plan. @@ -17,16 +16,13 @@ public required string AdjustmentID { get { - if (!this.Properties.TryGetValue("adjustment_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustment_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustment_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment_id"); } - set { this.Properties["adjustment_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,15 +32,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -56,16 +49,14 @@ public override void Validate() public RemoveAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemoveAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + RemoveAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemoveAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemoveAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemovePrice.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemovePrice.cs index 02f8cf32..4f80ec8a 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemovePrice.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/RemovePrice.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemovePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemovePrice : ModelBase, IFromRaw { /// /// The id of the price to remove from the plan. @@ -17,16 +16,13 @@ public required string PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_id"); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,15 +32,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -56,16 +49,14 @@ public override void Validate() public RemovePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemovePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + RemovePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemovePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemovePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustment.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustment.cs index 82739022..29008ff5 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustment.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplaceAdjustmentProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplaceAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the plan. @@ -18,17 +17,13 @@ public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw( - element - ) ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,25 +33,18 @@ public required string ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_adjustment_id"); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -67,15 +55,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -88,16 +73,14 @@ public override void Validate() public ReplaceAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplaceAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplaceAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplaceAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplaceAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs index 342e9fb1..819c297e 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the plan. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs index 28a66996..adc21e5a 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ReplaceAdjustmentProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePrice.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePrice.cs index b4c57994..0046bc52 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePrice.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePrice.cs @@ -1,16 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplacePriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplacePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplacePrice : ModelBase, IFromRaw { /// /// The id of the price on the plan to replace in the plan. @@ -19,37 +17,31 @@ public required string ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_price_id"); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_price_id"); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } /// /// The allocation price to add to the plan. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,30 +51,27 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// /// The price to add to the plan /// - public ReplacePriceProperties::Price? Price + public ReplacePriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -96,16 +85,14 @@ public override void Validate() public ReplacePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplacePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplacePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplacePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplacePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/Price.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/Price.cs deleted file mode 100644 index 237330c7..00000000 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/Price.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties; - -/// -/// The price to add to the plan -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewPlanUnitPrice Create(Models::NewPlanUnitPrice value) => - new(value); - - public static PriceVariants::NewPlanPackagePrice Create(Models::NewPlanPackagePrice value) => - new(value); - - public static PriceVariants::NewPlanMatrixPrice Create(Models::NewPlanMatrixPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredPrice Create(Models::NewPlanTieredPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredBPSPrice Create( - Models::NewPlanTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewPlanBPSPrice Create(Models::NewPlanBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkBPSPrice Create(Models::NewPlanBulkBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkPrice Create(Models::NewPlanBulkPrice value) => - new(value); - - public static PriceVariants::NewPlanThresholdTotalAmountPrice Create( - Models::NewPlanThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackagePrice Create( - Models::NewPlanTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredWithMinimumPrice Create( - Models::NewPlanTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithPercentPrice Create( - Models::NewPlanUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewPlanPackageWithAllocationPrice Create( - Models::NewPlanPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanTierWithProrationPrice Create( - Models::NewPlanTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithProrationPrice Create( - Models::NewPlanUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedAllocationPrice Create( - Models::NewPlanGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithProratedMinimumPrice Create( - Models::NewPlanGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithMeteredMinimumPrice Create( - Models::NewPlanGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithDisplayNamePrice Create( - Models::NewPlanMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewPlanBulkWithProrationPrice Create( - Models::NewPlanBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPackagePrice Create( - Models::NewPlanGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanMaxGroupTieredPackagePrice Create( - Models::NewPlanMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithUnitPricingPrice Create( - Models::NewPlanScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithTieredPricingPrice Create( - Models::NewPlanScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanCumulativeGroupedBulkPrice Create( - Models::NewPlanCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackageWithMinimumPrice Create( - Models::NewPlanTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithAllocationPrice Create( - Models::NewPlanMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPrice Create( - Models::NewPlanGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/Price1.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/Price1.cs new file mode 100644 index 00000000..a75efd70 --- /dev/null +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/Price1.cs @@ -0,0 +1,99 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceVariants; + +namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties; + +/// +/// The price to add to the plan +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewPlanUnitPrice value) => + new PriceVariants::NewPlanUnitPriceVariant(value); + + public static implicit operator Price1(NewPlanPackagePrice value) => + new PriceVariants::NewPlanPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixPrice value) => + new PriceVariants::NewPlanMatrixPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPrice value) => + new PriceVariants::NewPlanTieredPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredBPSPrice value) => + new PriceVariants::NewPlanTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBPSPrice value) => + new PriceVariants::NewPlanBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkBPSPrice value) => + new PriceVariants::NewPlanBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkPrice value) => + new PriceVariants::NewPlanBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanThresholdTotalAmountPrice value) => + new PriceVariants::NewPlanThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackagePrice value) => + new PriceVariants::NewPlanTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanTieredWithMinimumPrice value) => + new PriceVariants::NewPlanTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithPercentPrice value) => + new PriceVariants::NewPlanUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewPlanPackageWithAllocationPrice value) => + new PriceVariants::NewPlanPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanTierWithProrationPrice value) => + new PriceVariants::NewPlanTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithProrationPrice value) => + new PriceVariants::NewPlanUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedAllocationPrice value) => + new PriceVariants::NewPlanGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithDisplayNamePrice value) => + new PriceVariants::NewPlanMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewPlanBulkWithProrationPrice value) => + new PriceVariants::NewPlanBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPackagePrice value) => + new PriceVariants::NewPlanGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMaxGroupTieredPackagePrice value) => + new PriceVariants::NewPlanMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanCumulativeGroupedBulkPrice value) => + new PriceVariants::NewPlanCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackageWithMinimumPrice value) => + new PriceVariants::NewPlanTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithAllocationPrice value) => + new PriceVariants::NewPlanMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPrice value) => + new PriceVariants::NewPlanGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs index 1a916bd4..bfe1db0f 100644 --- a/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ReplacePriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanUnitPrice(Models::NewPlanUnitPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanUnitPriceVariant(NewPlanUnitPrice Value) + : Price1, + IVariant { - public static NewPlanUnitPrice From(Models::NewPlanUnitPrice value) + public static NewPlanUnitPriceVariant From(NewPlanUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanPackagePrice(Models::NewPlanPackagePrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanPackagePriceVariant(NewPlanPackagePrice Value) + : Price1, + IVariant { - public static NewPlanPackagePrice From(Models::NewPlanPackagePrice value) + public static NewPlanPackagePriceVariant From(NewPlanPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanMatrixPrice(Models::NewPlanMatrixPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanMatrixPriceVariant(NewPlanMatrixPrice Value) + : Price1, + IVariant { - public static NewPlanMatrixPrice From(Models::NewPlanMatrixPrice value) + public static NewPlanMatrixPriceVariant From(NewPlanMatrixPrice value) { return new(value); } @@ -59,14 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredPrice(Models::NewPlanTieredPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredPriceVariant(NewPlanTieredPrice Value) + : Price1, + IVariant { - public static NewPlanTieredPrice From(Models::NewPlanTieredPrice value) + public static NewPlanTieredPriceVariant From(NewPlanTieredPrice value) { return new(value); } @@ -77,14 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredBPSPrice(Models::NewPlanTieredBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredBPSPriceVariant(NewPlanTieredBPSPrice Value) + : Price1, + IVariant { - public static NewPlanTieredBPSPrice From(Models::NewPlanTieredBPSPrice value) + public static NewPlanTieredBPSPriceVariant From(NewPlanTieredBPSPrice value) { return new(value); } @@ -95,14 +82,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBPSPrice(Models::NewPlanBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBPSPriceVariant(NewPlanBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBPSPrice From(Models::NewPlanBPSPrice value) + public static NewPlanBPSPriceVariant From(NewPlanBPSPrice value) { return new(value); } @@ -113,14 +98,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkBPSPrice(Models::NewPlanBulkBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkBPSPriceVariant(NewPlanBulkBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBulkBPSPrice From(Models::NewPlanBulkBPSPrice value) + public static NewPlanBulkBPSPriceVariant From(NewPlanBulkBPSPrice value) { return new(value); } @@ -131,14 +114,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkPrice(Models::NewPlanBulkPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkPriceVariant(NewPlanBulkPrice Value) + : Price1, + IVariant { - public static NewPlanBulkPrice From(Models::NewPlanBulkPrice value) + public static NewPlanBulkPriceVariant From(NewPlanBulkPrice value) { return new(value); } @@ -149,20 +130,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanThresholdTotalAmountPrice, - Models::NewPlanThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanThresholdTotalAmountPriceVariant, + NewPlanThresholdTotalAmountPrice >) )] -public sealed record class NewPlanThresholdTotalAmountPrice( - Models::NewPlanThresholdTotalAmountPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanThresholdTotalAmountPriceVariant( + NewPlanThresholdTotalAmountPrice Value +) : Price1, IVariant { - public static NewPlanThresholdTotalAmountPrice From( - Models::NewPlanThresholdTotalAmountPrice value + public static NewPlanThresholdTotalAmountPriceVariant From( + NewPlanThresholdTotalAmountPrice value ) { return new(value); @@ -174,14 +153,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredPackagePrice(Models::NewPlanTieredPackagePrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredPackagePriceVariant(NewPlanTieredPackagePrice Value) + : Price1, + IVariant { - public static NewPlanTieredPackagePrice From(Models::NewPlanTieredPackagePrice value) + public static NewPlanTieredPackagePriceVariant From(NewPlanTieredPackagePrice value) { return new(value); } @@ -192,19 +171,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredWithMinimumPrice, - Models::NewPlanTieredWithMinimumPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredWithMinimumPrice( - Models::NewPlanTieredWithMinimumPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredWithMinimumPriceVariant(NewPlanTieredWithMinimumPrice Value) + : Price1, + IVariant { - public static NewPlanTieredWithMinimumPrice From(Models::NewPlanTieredWithMinimumPrice value) + public static NewPlanTieredWithMinimumPriceVariant From(NewPlanTieredWithMinimumPrice value) { return new(value); } @@ -215,14 +189,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithPercentPrice(Models::NewPlanUnitWithPercentPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithPercentPriceVariant(NewPlanUnitWithPercentPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithPercentPrice From(Models::NewPlanUnitWithPercentPrice value) + public static NewPlanUnitWithPercentPriceVariant From(NewPlanUnitWithPercentPrice value) { return new(value); } @@ -233,20 +207,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanPackageWithAllocationPrice, - Models::NewPlanPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanPackageWithAllocationPriceVariant, + NewPlanPackageWithAllocationPrice >) )] -public sealed record class NewPlanPackageWithAllocationPrice( - Models::NewPlanPackageWithAllocationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanPackageWithAllocationPriceVariant( + NewPlanPackageWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanPackageWithAllocationPrice From( - Models::NewPlanPackageWithAllocationPrice value + public static NewPlanPackageWithAllocationPriceVariant From( + NewPlanPackageWithAllocationPrice value ) { return new(value); @@ -258,19 +230,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTierWithProrationPrice, - Models::NewPlanTierWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTierWithProrationPrice( - Models::NewPlanTierWithProrationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTierWithProrationPriceVariant(NewPlanTierWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanTierWithProrationPrice From(Models::NewPlanTierWithProrationPrice value) + public static NewPlanTierWithProrationPriceVariant From(NewPlanTierWithProrationPrice value) { return new(value); } @@ -281,19 +248,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanUnitWithProrationPrice, - Models::NewPlanUnitWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithProrationPrice( - Models::NewPlanUnitWithProrationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithProrationPriceVariant(NewPlanUnitWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithProrationPrice From(Models::NewPlanUnitWithProrationPrice value) + public static NewPlanUnitWithProrationPriceVariant From(NewPlanUnitWithProrationPrice value) { return new(value); } @@ -304,19 +266,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedAllocationPrice, - Models::NewPlanGroupedAllocationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedAllocationPrice( - Models::NewPlanGroupedAllocationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedAllocationPriceVariant(NewPlanGroupedAllocationPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedAllocationPrice From(Models::NewPlanGroupedAllocationPrice value) + public static NewPlanGroupedAllocationPriceVariant From(NewPlanGroupedAllocationPrice value) { return new(value); } @@ -327,23 +284,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice >) )] -public sealed record class NewPlanGroupedWithProratedMinimumPrice( - Models::NewPlanGroupedWithProratedMinimumPrice Value +public sealed record class NewPlanGroupedWithProratedMinimumPriceVariant( + NewPlanGroupedWithProratedMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice > { - public static NewPlanGroupedWithProratedMinimumPrice From( - Models::NewPlanGroupedWithProratedMinimumPrice value + public static NewPlanGroupedWithProratedMinimumPriceVariant From( + NewPlanGroupedWithProratedMinimumPrice value ) { return new(value); @@ -355,23 +312,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewPlanGroupedWithMeteredMinimumPrice( - Models::NewPlanGroupedWithMeteredMinimumPrice Value +public sealed record class NewPlanGroupedWithMeteredMinimumPriceVariant( + NewPlanGroupedWithMeteredMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice > { - public static NewPlanGroupedWithMeteredMinimumPrice From( - Models::NewPlanGroupedWithMeteredMinimumPrice value + public static NewPlanGroupedWithMeteredMinimumPriceVariant From( + NewPlanGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -383,20 +340,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithDisplayNamePrice, - Models::NewPlanMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithDisplayNamePriceVariant, + NewPlanMatrixWithDisplayNamePrice >) )] -public sealed record class NewPlanMatrixWithDisplayNamePrice( - Models::NewPlanMatrixWithDisplayNamePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithDisplayNamePriceVariant( + NewPlanMatrixWithDisplayNamePrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithDisplayNamePrice From( - Models::NewPlanMatrixWithDisplayNamePrice value + public static NewPlanMatrixWithDisplayNamePriceVariant From( + NewPlanMatrixWithDisplayNamePrice value ) { return new(value); @@ -408,19 +363,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanBulkWithProrationPrice, - Models::NewPlanBulkWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanBulkWithProrationPrice( - Models::NewPlanBulkWithProrationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanBulkWithProrationPriceVariant(NewPlanBulkWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanBulkWithProrationPrice From(Models::NewPlanBulkWithProrationPrice value) + public static NewPlanBulkWithProrationPriceVariant From(NewPlanBulkWithProrationPrice value) { return new(value); } @@ -431,20 +381,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedTieredPackagePrice, - Models::NewPlanGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedTieredPackagePriceVariant, + NewPlanGroupedTieredPackagePrice >) )] -public sealed record class NewPlanGroupedTieredPackagePrice( - Models::NewPlanGroupedTieredPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPackagePriceVariant( + NewPlanGroupedTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanGroupedTieredPackagePrice From( - Models::NewPlanGroupedTieredPackagePrice value + public static NewPlanGroupedTieredPackagePriceVariant From( + NewPlanGroupedTieredPackagePrice value ) { return new(value); @@ -456,20 +404,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMaxGroupTieredPackagePrice, - Models::NewPlanMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMaxGroupTieredPackagePriceVariant, + NewPlanMaxGroupTieredPackagePrice >) )] -public sealed record class NewPlanMaxGroupTieredPackagePrice( - Models::NewPlanMaxGroupTieredPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMaxGroupTieredPackagePriceVariant( + NewPlanMaxGroupTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanMaxGroupTieredPackagePrice From( - Models::NewPlanMaxGroupTieredPackagePrice value + public static NewPlanMaxGroupTieredPackagePriceVariant From( + NewPlanMaxGroupTieredPackagePrice value ) { return new(value); @@ -481,23 +427,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithUnitPricingPrice( - Models::NewPlanScalableMatrixWithUnitPricingPrice Value +public sealed record class NewPlanScalableMatrixWithUnitPricingPriceVariant( + NewPlanScalableMatrixWithUnitPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice > { - public static NewPlanScalableMatrixWithUnitPricingPrice From( - Models::NewPlanScalableMatrixWithUnitPricingPrice value + public static NewPlanScalableMatrixWithUnitPricingPriceVariant From( + NewPlanScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -509,23 +455,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithTieredPricingPrice( - Models::NewPlanScalableMatrixWithTieredPricingPrice Value +public sealed record class NewPlanScalableMatrixWithTieredPricingPriceVariant( + NewPlanScalableMatrixWithTieredPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice > { - public static NewPlanScalableMatrixWithTieredPricingPrice From( - Models::NewPlanScalableMatrixWithTieredPricingPrice value + public static NewPlanScalableMatrixWithTieredPricingPriceVariant From( + NewPlanScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -537,20 +483,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanCumulativeGroupedBulkPrice, - Models::NewPlanCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanCumulativeGroupedBulkPriceVariant, + NewPlanCumulativeGroupedBulkPrice >) )] -public sealed record class NewPlanCumulativeGroupedBulkPrice( - Models::NewPlanCumulativeGroupedBulkPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanCumulativeGroupedBulkPriceVariant( + NewPlanCumulativeGroupedBulkPrice Value +) : Price1, IVariant { - public static NewPlanCumulativeGroupedBulkPrice From( - Models::NewPlanCumulativeGroupedBulkPrice value + public static NewPlanCumulativeGroupedBulkPriceVariant From( + NewPlanCumulativeGroupedBulkPrice value ) { return new(value); @@ -562,23 +506,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanTieredPackageWithMinimumPriceVariant, + NewPlanTieredPackageWithMinimumPrice >) )] -public sealed record class NewPlanTieredPackageWithMinimumPrice( - Models::NewPlanTieredPackageWithMinimumPrice Value +public sealed record class NewPlanTieredPackageWithMinimumPriceVariant( + NewPlanTieredPackageWithMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice - > + : Price1, + IVariant { - public static NewPlanTieredPackageWithMinimumPrice From( - Models::NewPlanTieredPackageWithMinimumPrice value + public static NewPlanTieredPackageWithMinimumPriceVariant From( + NewPlanTieredPackageWithMinimumPrice value ) { return new(value); @@ -590,20 +531,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithAllocationPrice, - Models::NewPlanMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithAllocationPriceVariant, + NewPlanMatrixWithAllocationPrice >) )] -public sealed record class NewPlanMatrixWithAllocationPrice( - Models::NewPlanMatrixWithAllocationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithAllocationPriceVariant( + NewPlanMatrixWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithAllocationPrice From( - Models::NewPlanMatrixWithAllocationPrice value + public static NewPlanMatrixWithAllocationPriceVariant From( + NewPlanMatrixWithAllocationPrice value ) { return new(value); @@ -615,14 +554,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedTieredPrice(Models::NewPlanGroupedTieredPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPriceVariant(NewPlanGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedTieredPrice From(Models::NewPlanGroupedTieredPrice value) + public static NewPlanGroupedTieredPriceVariant From(NewPlanGroupedTieredPrice value) { return new(value); } diff --git a/src/Orb/Models/Beta/BetaFetchPlanVersionParams.cs b/src/Orb/Models/Beta/BetaFetchPlanVersionParams.cs index 8e9be346..6d74ee28 100644 --- a/src/Orb/Models/Beta/BetaFetchPlanVersionParams.cs +++ b/src/Orb/Models/Beta/BetaFetchPlanVersionParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Beta; @@ -11,15 +10,15 @@ namespace Orb.Models.Beta; /// This endpoint is used to fetch a plan version. It returns the phases, prices, /// and adjustments present on this version of the plan. /// -public sealed record class BetaFetchPlanVersionParams : Orb::ParamsBase +public sealed record class BetaFetchPlanVersionParams : ParamsBase { public required string PlanID; public required string Version; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/{0}/versions/{1}", this.PlanID, this.Version) ) @@ -28,12 +27,12 @@ public sealed record class BetaFetchPlanVersionParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Beta/BetaSetDefaultPlanVersionParams.cs b/src/Orb/Models/Beta/BetaSetDefaultPlanVersionParams.cs index 2347b29e..fa634d1e 100644 --- a/src/Orb/Models/Beta/BetaSetDefaultPlanVersionParams.cs +++ b/src/Orb/Models/Beta/BetaSetDefaultPlanVersionParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Beta; @@ -13,9 +12,9 @@ namespace Orb.Models.Beta; /// /// This endpoint allows setting the default version of a plan. /// -public sealed record class BetaSetDefaultPlanVersionParams : Orb::ParamsBase +public sealed record class BetaSetDefaultPlanVersionParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string PlanID; @@ -26,20 +25,17 @@ public required long Version { get { - if (!this.BodyProperties.TryGetValue("version", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "version", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("version", out JsonElement element)) + throw new ArgumentOutOfRangeException("version", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["version"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/{0}/set_default_version", this.PlanID) ) @@ -48,21 +44,21 @@ public required long Version }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParams.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParams.cs index a9921896..341aff96 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParams.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParams.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using ExternalPlanIDCreatePlanVersionParamsProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; namespace Orb.Models.Beta.ExternalPlanID; @@ -14,9 +13,9 @@ namespace Orb.Models.Beta.ExternalPlanID; /// /// This endpoint allows the creation of a new plan version for an existing plan. /// -public sealed record class ExternalPlanIDCreatePlanVersionParams : Orb::ParamsBase +public sealed record class ExternalPlanIDCreatePlanVersionParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ExternalPlanID; @@ -27,146 +26,120 @@ public required long Version { get { - if (!this.BodyProperties.TryGetValue("version", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "version", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("version", out JsonElement element)) + throw new ArgumentOutOfRangeException("version", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["version"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional adjustments to be added to the plan. /// - public Generic::List? AddAdjustments + public List? AddAdjustments { get { - if (!this.BodyProperties.TryGetValue("add_adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["add_adjustments"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["add_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional prices to be added to the plan. /// - public Generic::List? AddPrices + public List? AddPrices { get { - if (!this.BodyProperties.TryGetValue("add_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["add_prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["add_prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Adjustments to be removed from the plan. /// - public Generic::List? RemoveAdjustments + public List? RemoveAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "remove_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("remove_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["remove_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["remove_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices to be removed from the plan. /// - public Generic::List? RemovePrices + public List? RemovePrices { get { - if (!this.BodyProperties.TryGetValue("remove_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("remove_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["remove_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["remove_prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Adjustments to be replaced with additional adjustments on the plan. /// - public Generic::List? ReplaceAdjustments + public List? ReplaceAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "replace_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("replace_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["replace_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["replace_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices to be replaced with additional prices on the plan. /// - public Generic::List? ReplacePrices + public List? ReplacePrices { get { - if (!this.BodyProperties.TryGetValue("replace_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("replace_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["replace_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["replace_prices"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,20 +149,17 @@ public bool? SetAsDefault { get { - if (!this.BodyProperties.TryGetValue("set_as_default", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("set_as_default", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["set_as_default"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["set_as_default"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/external_plan_id/{0}/versions", this.ExternalPlanID) ) @@ -198,21 +168,21 @@ public bool? SetAsDefault }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustment.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustment.cs index 5a8195b8..90aaad2e 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustment.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustment.cs @@ -1,15 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddAdjustmentProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddAdjustmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the plan. @@ -18,16 +17,13 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element) - ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +33,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +50,14 @@ public override void Validate() public AddAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + AddAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs index bd9ab4ca..bfdaaea3 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the plan. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs index 388b85ee..fd0fdbf4 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using AddAdjustmentProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPrice.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPrice.cs index 1b794dab..6fcda9fa 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPrice.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPrice.cs @@ -1,32 +1,27 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddPriceProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddPrice : ModelBase, IFromRaw { /// /// The allocation price to add to the plan. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,30 +31,27 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// /// The price to add to the plan /// - public AddPriceProperties::Price? Price + public AddPriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -72,16 +64,14 @@ public override void Validate() public AddPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + AddPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs deleted file mode 100644 index f1707164..00000000 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties; - -/// -/// The price to add to the plan -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewPlanUnitPrice Create(Models::NewPlanUnitPrice value) => - new(value); - - public static PriceVariants::NewPlanPackagePrice Create(Models::NewPlanPackagePrice value) => - new(value); - - public static PriceVariants::NewPlanMatrixPrice Create(Models::NewPlanMatrixPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredPrice Create(Models::NewPlanTieredPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredBPSPrice Create( - Models::NewPlanTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewPlanBPSPrice Create(Models::NewPlanBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkBPSPrice Create(Models::NewPlanBulkBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkPrice Create(Models::NewPlanBulkPrice value) => - new(value); - - public static PriceVariants::NewPlanThresholdTotalAmountPrice Create( - Models::NewPlanThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackagePrice Create( - Models::NewPlanTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredWithMinimumPrice Create( - Models::NewPlanTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithPercentPrice Create( - Models::NewPlanUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewPlanPackageWithAllocationPrice Create( - Models::NewPlanPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanTierWithProrationPrice Create( - Models::NewPlanTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithProrationPrice Create( - Models::NewPlanUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedAllocationPrice Create( - Models::NewPlanGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithProratedMinimumPrice Create( - Models::NewPlanGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithMeteredMinimumPrice Create( - Models::NewPlanGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithDisplayNamePrice Create( - Models::NewPlanMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewPlanBulkWithProrationPrice Create( - Models::NewPlanBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPackagePrice Create( - Models::NewPlanGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanMaxGroupTieredPackagePrice Create( - Models::NewPlanMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithUnitPricingPrice Create( - Models::NewPlanScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithTieredPricingPrice Create( - Models::NewPlanScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanCumulativeGroupedBulkPrice Create( - Models::NewPlanCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackageWithMinimumPrice Create( - Models::NewPlanTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithAllocationPrice Create( - Models::NewPlanMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPrice Create( - Models::NewPlanGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/Price1.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/Price1.cs new file mode 100644 index 00000000..af4c8545 --- /dev/null +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/Price1.cs @@ -0,0 +1,99 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants; + +namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties; + +/// +/// The price to add to the plan +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewPlanUnitPrice value) => + new PriceVariants::NewPlanUnitPriceVariant(value); + + public static implicit operator Price1(NewPlanPackagePrice value) => + new PriceVariants::NewPlanPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixPrice value) => + new PriceVariants::NewPlanMatrixPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPrice value) => + new PriceVariants::NewPlanTieredPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredBPSPrice value) => + new PriceVariants::NewPlanTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBPSPrice value) => + new PriceVariants::NewPlanBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkBPSPrice value) => + new PriceVariants::NewPlanBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkPrice value) => + new PriceVariants::NewPlanBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanThresholdTotalAmountPrice value) => + new PriceVariants::NewPlanThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackagePrice value) => + new PriceVariants::NewPlanTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanTieredWithMinimumPrice value) => + new PriceVariants::NewPlanTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithPercentPrice value) => + new PriceVariants::NewPlanUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewPlanPackageWithAllocationPrice value) => + new PriceVariants::NewPlanPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanTierWithProrationPrice value) => + new PriceVariants::NewPlanTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithProrationPrice value) => + new PriceVariants::NewPlanUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedAllocationPrice value) => + new PriceVariants::NewPlanGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithDisplayNamePrice value) => + new PriceVariants::NewPlanMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewPlanBulkWithProrationPrice value) => + new PriceVariants::NewPlanBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPackagePrice value) => + new PriceVariants::NewPlanGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMaxGroupTieredPackagePrice value) => + new PriceVariants::NewPlanMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanCumulativeGroupedBulkPrice value) => + new PriceVariants::NewPlanCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackageWithMinimumPrice value) => + new PriceVariants::NewPlanTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithAllocationPrice value) => + new PriceVariants::NewPlanMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPrice value) => + new PriceVariants::NewPlanGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs index 9911a0e2..441ed76a 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/AddPriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using AddPriceProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanUnitPrice(Models::NewPlanUnitPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanUnitPriceVariant(NewPlanUnitPrice Value) + : Price1, + IVariant { - public static NewPlanUnitPrice From(Models::NewPlanUnitPrice value) + public static NewPlanUnitPriceVariant From(NewPlanUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanPackagePrice(Models::NewPlanPackagePrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanPackagePriceVariant(NewPlanPackagePrice Value) + : Price1, + IVariant { - public static NewPlanPackagePrice From(Models::NewPlanPackagePrice value) + public static NewPlanPackagePriceVariant From(NewPlanPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanMatrixPrice(Models::NewPlanMatrixPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanMatrixPriceVariant(NewPlanMatrixPrice Value) + : Price1, + IVariant { - public static NewPlanMatrixPrice From(Models::NewPlanMatrixPrice value) + public static NewPlanMatrixPriceVariant From(NewPlanMatrixPrice value) { return new(value); } @@ -59,14 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredPrice(Models::NewPlanTieredPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredPriceVariant(NewPlanTieredPrice Value) + : Price1, + IVariant { - public static NewPlanTieredPrice From(Models::NewPlanTieredPrice value) + public static NewPlanTieredPriceVariant From(NewPlanTieredPrice value) { return new(value); } @@ -77,14 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredBPSPrice(Models::NewPlanTieredBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredBPSPriceVariant(NewPlanTieredBPSPrice Value) + : Price1, + IVariant { - public static NewPlanTieredBPSPrice From(Models::NewPlanTieredBPSPrice value) + public static NewPlanTieredBPSPriceVariant From(NewPlanTieredBPSPrice value) { return new(value); } @@ -95,14 +82,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBPSPrice(Models::NewPlanBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBPSPriceVariant(NewPlanBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBPSPrice From(Models::NewPlanBPSPrice value) + public static NewPlanBPSPriceVariant From(NewPlanBPSPrice value) { return new(value); } @@ -113,14 +98,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkBPSPrice(Models::NewPlanBulkBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkBPSPriceVariant(NewPlanBulkBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBulkBPSPrice From(Models::NewPlanBulkBPSPrice value) + public static NewPlanBulkBPSPriceVariant From(NewPlanBulkBPSPrice value) { return new(value); } @@ -131,14 +114,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkPrice(Models::NewPlanBulkPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkPriceVariant(NewPlanBulkPrice Value) + : Price1, + IVariant { - public static NewPlanBulkPrice From(Models::NewPlanBulkPrice value) + public static NewPlanBulkPriceVariant From(NewPlanBulkPrice value) { return new(value); } @@ -149,20 +130,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanThresholdTotalAmountPrice, - Models::NewPlanThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanThresholdTotalAmountPriceVariant, + NewPlanThresholdTotalAmountPrice >) )] -public sealed record class NewPlanThresholdTotalAmountPrice( - Models::NewPlanThresholdTotalAmountPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanThresholdTotalAmountPriceVariant( + NewPlanThresholdTotalAmountPrice Value +) : Price1, IVariant { - public static NewPlanThresholdTotalAmountPrice From( - Models::NewPlanThresholdTotalAmountPrice value + public static NewPlanThresholdTotalAmountPriceVariant From( + NewPlanThresholdTotalAmountPrice value ) { return new(value); @@ -174,14 +153,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredPackagePrice(Models::NewPlanTieredPackagePrice Value) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredPackagePriceVariant(NewPlanTieredPackagePrice Value) + : Price1, + IVariant { - public static NewPlanTieredPackagePrice From(Models::NewPlanTieredPackagePrice value) + public static NewPlanTieredPackagePriceVariant From(NewPlanTieredPackagePrice value) { return new(value); } @@ -192,19 +171,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredWithMinimumPrice, - Models::NewPlanTieredWithMinimumPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredWithMinimumPrice( - Models::NewPlanTieredWithMinimumPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredWithMinimumPriceVariant(NewPlanTieredWithMinimumPrice Value) + : Price1, + IVariant { - public static NewPlanTieredWithMinimumPrice From(Models::NewPlanTieredWithMinimumPrice value) + public static NewPlanTieredWithMinimumPriceVariant From(NewPlanTieredWithMinimumPrice value) { return new(value); } @@ -215,14 +189,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithPercentPrice(Models::NewPlanUnitWithPercentPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithPercentPriceVariant(NewPlanUnitWithPercentPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithPercentPrice From(Models::NewPlanUnitWithPercentPrice value) + public static NewPlanUnitWithPercentPriceVariant From(NewPlanUnitWithPercentPrice value) { return new(value); } @@ -233,20 +207,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanPackageWithAllocationPrice, - Models::NewPlanPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanPackageWithAllocationPriceVariant, + NewPlanPackageWithAllocationPrice >) )] -public sealed record class NewPlanPackageWithAllocationPrice( - Models::NewPlanPackageWithAllocationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanPackageWithAllocationPriceVariant( + NewPlanPackageWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanPackageWithAllocationPrice From( - Models::NewPlanPackageWithAllocationPrice value + public static NewPlanPackageWithAllocationPriceVariant From( + NewPlanPackageWithAllocationPrice value ) { return new(value); @@ -258,19 +230,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTierWithProrationPrice, - Models::NewPlanTierWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTierWithProrationPrice( - Models::NewPlanTierWithProrationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTierWithProrationPriceVariant(NewPlanTierWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanTierWithProrationPrice From(Models::NewPlanTierWithProrationPrice value) + public static NewPlanTierWithProrationPriceVariant From(NewPlanTierWithProrationPrice value) { return new(value); } @@ -281,19 +248,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanUnitWithProrationPrice, - Models::NewPlanUnitWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithProrationPrice( - Models::NewPlanUnitWithProrationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithProrationPriceVariant(NewPlanUnitWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithProrationPrice From(Models::NewPlanUnitWithProrationPrice value) + public static NewPlanUnitWithProrationPriceVariant From(NewPlanUnitWithProrationPrice value) { return new(value); } @@ -304,19 +266,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedAllocationPrice, - Models::NewPlanGroupedAllocationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedAllocationPrice( - Models::NewPlanGroupedAllocationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedAllocationPriceVariant(NewPlanGroupedAllocationPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedAllocationPrice From(Models::NewPlanGroupedAllocationPrice value) + public static NewPlanGroupedAllocationPriceVariant From(NewPlanGroupedAllocationPrice value) { return new(value); } @@ -327,23 +284,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice >) )] -public sealed record class NewPlanGroupedWithProratedMinimumPrice( - Models::NewPlanGroupedWithProratedMinimumPrice Value +public sealed record class NewPlanGroupedWithProratedMinimumPriceVariant( + NewPlanGroupedWithProratedMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice > { - public static NewPlanGroupedWithProratedMinimumPrice From( - Models::NewPlanGroupedWithProratedMinimumPrice value + public static NewPlanGroupedWithProratedMinimumPriceVariant From( + NewPlanGroupedWithProratedMinimumPrice value ) { return new(value); @@ -355,23 +312,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewPlanGroupedWithMeteredMinimumPrice( - Models::NewPlanGroupedWithMeteredMinimumPrice Value +public sealed record class NewPlanGroupedWithMeteredMinimumPriceVariant( + NewPlanGroupedWithMeteredMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice > { - public static NewPlanGroupedWithMeteredMinimumPrice From( - Models::NewPlanGroupedWithMeteredMinimumPrice value + public static NewPlanGroupedWithMeteredMinimumPriceVariant From( + NewPlanGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -383,20 +340,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithDisplayNamePrice, - Models::NewPlanMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithDisplayNamePriceVariant, + NewPlanMatrixWithDisplayNamePrice >) )] -public sealed record class NewPlanMatrixWithDisplayNamePrice( - Models::NewPlanMatrixWithDisplayNamePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithDisplayNamePriceVariant( + NewPlanMatrixWithDisplayNamePrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithDisplayNamePrice From( - Models::NewPlanMatrixWithDisplayNamePrice value + public static NewPlanMatrixWithDisplayNamePriceVariant From( + NewPlanMatrixWithDisplayNamePrice value ) { return new(value); @@ -408,19 +363,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanBulkWithProrationPrice, - Models::NewPlanBulkWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanBulkWithProrationPrice( - Models::NewPlanBulkWithProrationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanBulkWithProrationPriceVariant(NewPlanBulkWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanBulkWithProrationPrice From(Models::NewPlanBulkWithProrationPrice value) + public static NewPlanBulkWithProrationPriceVariant From(NewPlanBulkWithProrationPrice value) { return new(value); } @@ -431,20 +381,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedTieredPackagePrice, - Models::NewPlanGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedTieredPackagePriceVariant, + NewPlanGroupedTieredPackagePrice >) )] -public sealed record class NewPlanGroupedTieredPackagePrice( - Models::NewPlanGroupedTieredPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPackagePriceVariant( + NewPlanGroupedTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanGroupedTieredPackagePrice From( - Models::NewPlanGroupedTieredPackagePrice value + public static NewPlanGroupedTieredPackagePriceVariant From( + NewPlanGroupedTieredPackagePrice value ) { return new(value); @@ -456,20 +404,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMaxGroupTieredPackagePrice, - Models::NewPlanMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMaxGroupTieredPackagePriceVariant, + NewPlanMaxGroupTieredPackagePrice >) )] -public sealed record class NewPlanMaxGroupTieredPackagePrice( - Models::NewPlanMaxGroupTieredPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMaxGroupTieredPackagePriceVariant( + NewPlanMaxGroupTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanMaxGroupTieredPackagePrice From( - Models::NewPlanMaxGroupTieredPackagePrice value + public static NewPlanMaxGroupTieredPackagePriceVariant From( + NewPlanMaxGroupTieredPackagePrice value ) { return new(value); @@ -481,23 +427,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithUnitPricingPrice( - Models::NewPlanScalableMatrixWithUnitPricingPrice Value +public sealed record class NewPlanScalableMatrixWithUnitPricingPriceVariant( + NewPlanScalableMatrixWithUnitPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice > { - public static NewPlanScalableMatrixWithUnitPricingPrice From( - Models::NewPlanScalableMatrixWithUnitPricingPrice value + public static NewPlanScalableMatrixWithUnitPricingPriceVariant From( + NewPlanScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -509,23 +455,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithTieredPricingPrice( - Models::NewPlanScalableMatrixWithTieredPricingPrice Value +public sealed record class NewPlanScalableMatrixWithTieredPricingPriceVariant( + NewPlanScalableMatrixWithTieredPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice > { - public static NewPlanScalableMatrixWithTieredPricingPrice From( - Models::NewPlanScalableMatrixWithTieredPricingPrice value + public static NewPlanScalableMatrixWithTieredPricingPriceVariant From( + NewPlanScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -537,20 +483,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanCumulativeGroupedBulkPrice, - Models::NewPlanCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanCumulativeGroupedBulkPriceVariant, + NewPlanCumulativeGroupedBulkPrice >) )] -public sealed record class NewPlanCumulativeGroupedBulkPrice( - Models::NewPlanCumulativeGroupedBulkPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanCumulativeGroupedBulkPriceVariant( + NewPlanCumulativeGroupedBulkPrice Value +) : Price1, IVariant { - public static NewPlanCumulativeGroupedBulkPrice From( - Models::NewPlanCumulativeGroupedBulkPrice value + public static NewPlanCumulativeGroupedBulkPriceVariant From( + NewPlanCumulativeGroupedBulkPrice value ) { return new(value); @@ -562,23 +506,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanTieredPackageWithMinimumPriceVariant, + NewPlanTieredPackageWithMinimumPrice >) )] -public sealed record class NewPlanTieredPackageWithMinimumPrice( - Models::NewPlanTieredPackageWithMinimumPrice Value +public sealed record class NewPlanTieredPackageWithMinimumPriceVariant( + NewPlanTieredPackageWithMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice - > + : Price1, + IVariant { - public static NewPlanTieredPackageWithMinimumPrice From( - Models::NewPlanTieredPackageWithMinimumPrice value + public static NewPlanTieredPackageWithMinimumPriceVariant From( + NewPlanTieredPackageWithMinimumPrice value ) { return new(value); @@ -590,20 +531,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithAllocationPrice, - Models::NewPlanMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithAllocationPriceVariant, + NewPlanMatrixWithAllocationPrice >) )] -public sealed record class NewPlanMatrixWithAllocationPrice( - Models::NewPlanMatrixWithAllocationPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithAllocationPriceVariant( + NewPlanMatrixWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithAllocationPrice From( - Models::NewPlanMatrixWithAllocationPrice value + public static NewPlanMatrixWithAllocationPriceVariant From( + NewPlanMatrixWithAllocationPrice value ) { return new(value); @@ -615,14 +554,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedTieredPrice(Models::NewPlanGroupedTieredPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPriceVariant(NewPlanGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedTieredPrice From(Models::NewPlanGroupedTieredPrice value) + public static NewPlanGroupedTieredPriceVariant From(NewPlanGroupedTieredPrice value) { return new(value); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemoveAdjustment.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemoveAdjustment.cs index 87adf1e2..5b70f8bf 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemoveAdjustment.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemoveAdjustment.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemoveAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemoveAdjustment : ModelBase, IFromRaw { /// /// The id of the adjustment to remove from on the plan. @@ -17,16 +16,13 @@ public required string AdjustmentID { get { - if (!this.Properties.TryGetValue("adjustment_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustment_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustment_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment_id"); } - set { this.Properties["adjustment_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,15 +32,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -56,16 +49,14 @@ public override void Validate() public RemoveAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemoveAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + RemoveAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemoveAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemoveAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemovePrice.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemovePrice.cs index 5fcedf63..1da9d5d5 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemovePrice.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/RemovePrice.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemovePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemovePrice : ModelBase, IFromRaw { /// /// The id of the price to remove from the plan. @@ -17,16 +16,13 @@ public required string PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_id"); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,15 +32,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -56,16 +49,14 @@ public override void Validate() public RemovePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemovePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + RemovePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemovePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemovePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustment.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustment.cs index 89e96ce8..7c6ee096 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustment.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplaceAdjustmentProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplaceAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the plan. @@ -18,17 +17,13 @@ public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw( - element - ) ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,25 +33,18 @@ public required string ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_adjustment_id"); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -67,15 +55,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -88,16 +73,14 @@ public override void Validate() public ReplaceAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplaceAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplaceAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplaceAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplaceAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs index 55daca0c..c51e1421 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the plan. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs index 38487a11..bd7f37f5 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ReplaceAdjustmentProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePrice.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePrice.cs index 6a78cc65..63b50dd4 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePrice.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePrice.cs @@ -1,16 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplacePriceProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplacePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplacePrice : ModelBase, IFromRaw { /// /// The id of the price on the plan to replace in the plan. @@ -19,37 +17,31 @@ public required string ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_price_id"); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_price_id"); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } /// /// The allocation price to add to the plan. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,30 +51,27 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// /// The price to add to the plan /// - public ReplacePriceProperties::Price? Price + public ReplacePriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -96,16 +85,14 @@ public override void Validate() public ReplacePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplacePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplacePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplacePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplacePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/Price.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/Price.cs deleted file mode 100644 index cf41ed4e..00000000 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/Price.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties; - -/// -/// The price to add to the plan -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewPlanUnitPrice Create(Models::NewPlanUnitPrice value) => - new(value); - - public static PriceVariants::NewPlanPackagePrice Create(Models::NewPlanPackagePrice value) => - new(value); - - public static PriceVariants::NewPlanMatrixPrice Create(Models::NewPlanMatrixPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredPrice Create(Models::NewPlanTieredPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredBPSPrice Create( - Models::NewPlanTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewPlanBPSPrice Create(Models::NewPlanBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkBPSPrice Create(Models::NewPlanBulkBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkPrice Create(Models::NewPlanBulkPrice value) => - new(value); - - public static PriceVariants::NewPlanThresholdTotalAmountPrice Create( - Models::NewPlanThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackagePrice Create( - Models::NewPlanTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredWithMinimumPrice Create( - Models::NewPlanTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithPercentPrice Create( - Models::NewPlanUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewPlanPackageWithAllocationPrice Create( - Models::NewPlanPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanTierWithProrationPrice Create( - Models::NewPlanTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithProrationPrice Create( - Models::NewPlanUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedAllocationPrice Create( - Models::NewPlanGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithProratedMinimumPrice Create( - Models::NewPlanGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithMeteredMinimumPrice Create( - Models::NewPlanGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithDisplayNamePrice Create( - Models::NewPlanMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewPlanBulkWithProrationPrice Create( - Models::NewPlanBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPackagePrice Create( - Models::NewPlanGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanMaxGroupTieredPackagePrice Create( - Models::NewPlanMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithUnitPricingPrice Create( - Models::NewPlanScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithTieredPricingPrice Create( - Models::NewPlanScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanCumulativeGroupedBulkPrice Create( - Models::NewPlanCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackageWithMinimumPrice Create( - Models::NewPlanTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithAllocationPrice Create( - Models::NewPlanMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPrice Create( - Models::NewPlanGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/Price1.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/Price1.cs new file mode 100644 index 00000000..497b4276 --- /dev/null +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/Price1.cs @@ -0,0 +1,99 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceVariants; + +namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties; + +/// +/// The price to add to the plan +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewPlanUnitPrice value) => + new PriceVariants::NewPlanUnitPriceVariant(value); + + public static implicit operator Price1(NewPlanPackagePrice value) => + new PriceVariants::NewPlanPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixPrice value) => + new PriceVariants::NewPlanMatrixPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPrice value) => + new PriceVariants::NewPlanTieredPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredBPSPrice value) => + new PriceVariants::NewPlanTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBPSPrice value) => + new PriceVariants::NewPlanBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkBPSPrice value) => + new PriceVariants::NewPlanBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewPlanBulkPrice value) => + new PriceVariants::NewPlanBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanThresholdTotalAmountPrice value) => + new PriceVariants::NewPlanThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackagePrice value) => + new PriceVariants::NewPlanTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanTieredWithMinimumPrice value) => + new PriceVariants::NewPlanTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithPercentPrice value) => + new PriceVariants::NewPlanUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewPlanPackageWithAllocationPrice value) => + new PriceVariants::NewPlanPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanTierWithProrationPrice value) => + new PriceVariants::NewPlanTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanUnitWithProrationPrice value) => + new PriceVariants::NewPlanUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedAllocationPrice value) => + new PriceVariants::NewPlanGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithDisplayNamePrice value) => + new PriceVariants::NewPlanMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewPlanBulkWithProrationPrice value) => + new PriceVariants::NewPlanBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPackagePrice value) => + new PriceVariants::NewPlanGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanMaxGroupTieredPackagePrice value) => + new PriceVariants::NewPlanMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewPlanCumulativeGroupedBulkPrice value) => + new PriceVariants::NewPlanCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewPlanTieredPackageWithMinimumPrice value) => + new PriceVariants::NewPlanTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewPlanMatrixWithAllocationPrice value) => + new PriceVariants::NewPlanMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewPlanGroupedTieredPrice value) => + new PriceVariants::NewPlanGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs index b4511ab8..842ffc67 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDCreatePlanVersionParamsProperties/ReplacePriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ReplacePriceProperties = Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanUnitPrice(Models::NewPlanUnitPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanUnitPriceVariant(NewPlanUnitPrice Value) + : Price1, + IVariant { - public static NewPlanUnitPrice From(Models::NewPlanUnitPrice value) + public static NewPlanUnitPriceVariant From(NewPlanUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanPackagePrice(Models::NewPlanPackagePrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanPackagePriceVariant(NewPlanPackagePrice Value) + : Price1, + IVariant { - public static NewPlanPackagePrice From(Models::NewPlanPackagePrice value) + public static NewPlanPackagePriceVariant From(NewPlanPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanMatrixPrice(Models::NewPlanMatrixPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanMatrixPriceVariant(NewPlanMatrixPrice Value) + : Price1, + IVariant { - public static NewPlanMatrixPrice From(Models::NewPlanMatrixPrice value) + public static NewPlanMatrixPriceVariant From(NewPlanMatrixPrice value) { return new(value); } @@ -59,14 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredPrice(Models::NewPlanTieredPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredPriceVariant(NewPlanTieredPrice Value) + : Price1, + IVariant { - public static NewPlanTieredPrice From(Models::NewPlanTieredPrice value) + public static NewPlanTieredPriceVariant From(NewPlanTieredPrice value) { return new(value); } @@ -77,14 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredBPSPrice(Models::NewPlanTieredBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredBPSPriceVariant(NewPlanTieredBPSPrice Value) + : Price1, + IVariant { - public static NewPlanTieredBPSPrice From(Models::NewPlanTieredBPSPrice value) + public static NewPlanTieredBPSPriceVariant From(NewPlanTieredBPSPrice value) { return new(value); } @@ -95,14 +82,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBPSPrice(Models::NewPlanBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBPSPriceVariant(NewPlanBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBPSPrice From(Models::NewPlanBPSPrice value) + public static NewPlanBPSPriceVariant From(NewPlanBPSPrice value) { return new(value); } @@ -113,14 +98,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkBPSPrice(Models::NewPlanBulkBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkBPSPriceVariant(NewPlanBulkBPSPrice Value) + : Price1, + IVariant { - public static NewPlanBulkBPSPrice From(Models::NewPlanBulkBPSPrice value) + public static NewPlanBulkBPSPriceVariant From(NewPlanBulkBPSPrice value) { return new(value); } @@ -131,14 +114,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkPrice(Models::NewPlanBulkPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkPriceVariant(NewPlanBulkPrice Value) + : Price1, + IVariant { - public static NewPlanBulkPrice From(Models::NewPlanBulkPrice value) + public static NewPlanBulkPriceVariant From(NewPlanBulkPrice value) { return new(value); } @@ -149,20 +130,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanThresholdTotalAmountPrice, - Models::NewPlanThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanThresholdTotalAmountPriceVariant, + NewPlanThresholdTotalAmountPrice >) )] -public sealed record class NewPlanThresholdTotalAmountPrice( - Models::NewPlanThresholdTotalAmountPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanThresholdTotalAmountPriceVariant( + NewPlanThresholdTotalAmountPrice Value +) : Price1, IVariant { - public static NewPlanThresholdTotalAmountPrice From( - Models::NewPlanThresholdTotalAmountPrice value + public static NewPlanThresholdTotalAmountPriceVariant From( + NewPlanThresholdTotalAmountPrice value ) { return new(value); @@ -174,14 +153,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredPackagePrice(Models::NewPlanTieredPackagePrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredPackagePriceVariant(NewPlanTieredPackagePrice Value) + : Price1, + IVariant { - public static NewPlanTieredPackagePrice From(Models::NewPlanTieredPackagePrice value) + public static NewPlanTieredPackagePriceVariant From(NewPlanTieredPackagePrice value) { return new(value); } @@ -192,19 +171,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredWithMinimumPrice, - Models::NewPlanTieredWithMinimumPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredWithMinimumPrice( - Models::NewPlanTieredWithMinimumPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredWithMinimumPriceVariant(NewPlanTieredWithMinimumPrice Value) + : Price1, + IVariant { - public static NewPlanTieredWithMinimumPrice From(Models::NewPlanTieredWithMinimumPrice value) + public static NewPlanTieredWithMinimumPriceVariant From(NewPlanTieredWithMinimumPrice value) { return new(value); } @@ -215,14 +189,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithPercentPrice(Models::NewPlanUnitWithPercentPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithPercentPriceVariant(NewPlanUnitWithPercentPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithPercentPrice From(Models::NewPlanUnitWithPercentPrice value) + public static NewPlanUnitWithPercentPriceVariant From(NewPlanUnitWithPercentPrice value) { return new(value); } @@ -233,20 +207,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanPackageWithAllocationPrice, - Models::NewPlanPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanPackageWithAllocationPriceVariant, + NewPlanPackageWithAllocationPrice >) )] -public sealed record class NewPlanPackageWithAllocationPrice( - Models::NewPlanPackageWithAllocationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanPackageWithAllocationPriceVariant( + NewPlanPackageWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanPackageWithAllocationPrice From( - Models::NewPlanPackageWithAllocationPrice value + public static NewPlanPackageWithAllocationPriceVariant From( + NewPlanPackageWithAllocationPrice value ) { return new(value); @@ -258,19 +230,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTierWithProrationPrice, - Models::NewPlanTierWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTierWithProrationPrice( - Models::NewPlanTierWithProrationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTierWithProrationPriceVariant(NewPlanTierWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanTierWithProrationPrice From(Models::NewPlanTierWithProrationPrice value) + public static NewPlanTierWithProrationPriceVariant From(NewPlanTierWithProrationPrice value) { return new(value); } @@ -281,19 +248,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanUnitWithProrationPrice, - Models::NewPlanUnitWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithProrationPrice( - Models::NewPlanUnitWithProrationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithProrationPriceVariant(NewPlanUnitWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanUnitWithProrationPrice From(Models::NewPlanUnitWithProrationPrice value) + public static NewPlanUnitWithProrationPriceVariant From(NewPlanUnitWithProrationPrice value) { return new(value); } @@ -304,19 +266,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedAllocationPrice, - Models::NewPlanGroupedAllocationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedAllocationPrice( - Models::NewPlanGroupedAllocationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedAllocationPriceVariant(NewPlanGroupedAllocationPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedAllocationPrice From(Models::NewPlanGroupedAllocationPrice value) + public static NewPlanGroupedAllocationPriceVariant From(NewPlanGroupedAllocationPrice value) { return new(value); } @@ -327,23 +284,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice >) )] -public sealed record class NewPlanGroupedWithProratedMinimumPrice( - Models::NewPlanGroupedWithProratedMinimumPrice Value +public sealed record class NewPlanGroupedWithProratedMinimumPriceVariant( + NewPlanGroupedWithProratedMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice > { - public static NewPlanGroupedWithProratedMinimumPrice From( - Models::NewPlanGroupedWithProratedMinimumPrice value + public static NewPlanGroupedWithProratedMinimumPriceVariant From( + NewPlanGroupedWithProratedMinimumPrice value ) { return new(value); @@ -355,23 +312,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewPlanGroupedWithMeteredMinimumPrice( - Models::NewPlanGroupedWithMeteredMinimumPrice Value +public sealed record class NewPlanGroupedWithMeteredMinimumPriceVariant( + NewPlanGroupedWithMeteredMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice > { - public static NewPlanGroupedWithMeteredMinimumPrice From( - Models::NewPlanGroupedWithMeteredMinimumPrice value + public static NewPlanGroupedWithMeteredMinimumPriceVariant From( + NewPlanGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -383,20 +340,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithDisplayNamePrice, - Models::NewPlanMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithDisplayNamePriceVariant, + NewPlanMatrixWithDisplayNamePrice >) )] -public sealed record class NewPlanMatrixWithDisplayNamePrice( - Models::NewPlanMatrixWithDisplayNamePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithDisplayNamePriceVariant( + NewPlanMatrixWithDisplayNamePrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithDisplayNamePrice From( - Models::NewPlanMatrixWithDisplayNamePrice value + public static NewPlanMatrixWithDisplayNamePriceVariant From( + NewPlanMatrixWithDisplayNamePrice value ) { return new(value); @@ -408,19 +363,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanBulkWithProrationPrice, - Models::NewPlanBulkWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanBulkWithProrationPrice( - Models::NewPlanBulkWithProrationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanBulkWithProrationPriceVariant(NewPlanBulkWithProrationPrice Value) + : Price1, + IVariant { - public static NewPlanBulkWithProrationPrice From(Models::NewPlanBulkWithProrationPrice value) + public static NewPlanBulkWithProrationPriceVariant From(NewPlanBulkWithProrationPrice value) { return new(value); } @@ -431,20 +381,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedTieredPackagePrice, - Models::NewPlanGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedTieredPackagePriceVariant, + NewPlanGroupedTieredPackagePrice >) )] -public sealed record class NewPlanGroupedTieredPackagePrice( - Models::NewPlanGroupedTieredPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPackagePriceVariant( + NewPlanGroupedTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanGroupedTieredPackagePrice From( - Models::NewPlanGroupedTieredPackagePrice value + public static NewPlanGroupedTieredPackagePriceVariant From( + NewPlanGroupedTieredPackagePrice value ) { return new(value); @@ -456,20 +404,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMaxGroupTieredPackagePrice, - Models::NewPlanMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMaxGroupTieredPackagePriceVariant, + NewPlanMaxGroupTieredPackagePrice >) )] -public sealed record class NewPlanMaxGroupTieredPackagePrice( - Models::NewPlanMaxGroupTieredPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMaxGroupTieredPackagePriceVariant( + NewPlanMaxGroupTieredPackagePrice Value +) : Price1, IVariant { - public static NewPlanMaxGroupTieredPackagePrice From( - Models::NewPlanMaxGroupTieredPackagePrice value + public static NewPlanMaxGroupTieredPackagePriceVariant From( + NewPlanMaxGroupTieredPackagePrice value ) { return new(value); @@ -481,23 +427,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithUnitPricingPrice( - Models::NewPlanScalableMatrixWithUnitPricingPrice Value +public sealed record class NewPlanScalableMatrixWithUnitPricingPriceVariant( + NewPlanScalableMatrixWithUnitPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice > { - public static NewPlanScalableMatrixWithUnitPricingPrice From( - Models::NewPlanScalableMatrixWithUnitPricingPrice value + public static NewPlanScalableMatrixWithUnitPricingPriceVariant From( + NewPlanScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -509,23 +455,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithTieredPricingPrice( - Models::NewPlanScalableMatrixWithTieredPricingPrice Value +public sealed record class NewPlanScalableMatrixWithTieredPricingPriceVariant( + NewPlanScalableMatrixWithTieredPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice > { - public static NewPlanScalableMatrixWithTieredPricingPrice From( - Models::NewPlanScalableMatrixWithTieredPricingPrice value + public static NewPlanScalableMatrixWithTieredPricingPriceVariant From( + NewPlanScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -537,20 +483,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanCumulativeGroupedBulkPrice, - Models::NewPlanCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanCumulativeGroupedBulkPriceVariant, + NewPlanCumulativeGroupedBulkPrice >) )] -public sealed record class NewPlanCumulativeGroupedBulkPrice( - Models::NewPlanCumulativeGroupedBulkPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanCumulativeGroupedBulkPriceVariant( + NewPlanCumulativeGroupedBulkPrice Value +) : Price1, IVariant { - public static NewPlanCumulativeGroupedBulkPrice From( - Models::NewPlanCumulativeGroupedBulkPrice value + public static NewPlanCumulativeGroupedBulkPriceVariant From( + NewPlanCumulativeGroupedBulkPrice value ) { return new(value); @@ -562,23 +506,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanTieredPackageWithMinimumPriceVariant, + NewPlanTieredPackageWithMinimumPrice >) )] -public sealed record class NewPlanTieredPackageWithMinimumPrice( - Models::NewPlanTieredPackageWithMinimumPrice Value +public sealed record class NewPlanTieredPackageWithMinimumPriceVariant( + NewPlanTieredPackageWithMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice - > + : Price1, + IVariant { - public static NewPlanTieredPackageWithMinimumPrice From( - Models::NewPlanTieredPackageWithMinimumPrice value + public static NewPlanTieredPackageWithMinimumPriceVariant From( + NewPlanTieredPackageWithMinimumPrice value ) { return new(value); @@ -590,20 +531,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithAllocationPrice, - Models::NewPlanMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithAllocationPriceVariant, + NewPlanMatrixWithAllocationPrice >) )] -public sealed record class NewPlanMatrixWithAllocationPrice( - Models::NewPlanMatrixWithAllocationPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithAllocationPriceVariant( + NewPlanMatrixWithAllocationPrice Value +) : Price1, IVariant { - public static NewPlanMatrixWithAllocationPrice From( - Models::NewPlanMatrixWithAllocationPrice value + public static NewPlanMatrixWithAllocationPriceVariant From( + NewPlanMatrixWithAllocationPrice value ) { return new(value); @@ -615,14 +554,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedTieredPrice(Models::NewPlanGroupedTieredPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPriceVariant(NewPlanGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewPlanGroupedTieredPrice From(Models::NewPlanGroupedTieredPrice value) + public static NewPlanGroupedTieredPriceVariant From(NewPlanGroupedTieredPrice value) { return new(value); } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDFetchPlanVersionParams.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDFetchPlanVersionParams.cs index 03fc9227..7036178d 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDFetchPlanVersionParams.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDFetchPlanVersionParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Beta.ExternalPlanID; @@ -11,15 +10,15 @@ namespace Orb.Models.Beta.ExternalPlanID; /// This endpoint is used to fetch a plan version. It returns the phases, prices, /// and adjustments present on this version of the plan. /// -public sealed record class ExternalPlanIDFetchPlanVersionParams : Orb::ParamsBase +public sealed record class ExternalPlanIDFetchPlanVersionParams : ParamsBase { public required string ExternalPlanID; public required string Version; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/plans/external_plan_id/{0}/versions/{1}", @@ -32,12 +31,12 @@ public sealed record class ExternalPlanIDFetchPlanVersionParams : Orb::ParamsBas }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDSetDefaultPlanVersionParams.cs b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDSetDefaultPlanVersionParams.cs index 09a15732..2ce90604 100644 --- a/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDSetDefaultPlanVersionParams.cs +++ b/src/Orb/Models/Beta/ExternalPlanID/ExternalPlanIDSetDefaultPlanVersionParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Beta.ExternalPlanID; @@ -13,9 +12,9 @@ namespace Orb.Models.Beta.ExternalPlanID; /// /// This endpoint allows setting the default version of a plan. /// -public sealed record class ExternalPlanIDSetDefaultPlanVersionParams : Orb::ParamsBase +public sealed record class ExternalPlanIDSetDefaultPlanVersionParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ExternalPlanID; @@ -26,20 +25,17 @@ public required long Version { get { - if (!this.BodyProperties.TryGetValue("version", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "version", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("version", out JsonElement element)) + throw new ArgumentOutOfRangeException("version", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["version"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/plans/external_plan_id/{0}/set_default_version", @@ -51,21 +47,21 @@ public required long Version }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Beta/PlanVersion.cs b/src/Orb/Models/Beta/PlanVersion.cs index 286a8a79..045759d8 100644 --- a/src/Orb/Models/Beta/PlanVersion.cs +++ b/src/Orb/Models/Beta/PlanVersion.cs @@ -1,11 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanVersionProperties = Orb.Models.Beta.PlanVersionProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta; @@ -13,93 +11,77 @@ namespace Orb.Models.Beta; /// The PlanVersion resource represents the prices and adjustments present on a specific /// version of a plan. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PlanVersion : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PlanVersion : ModelBase, IFromRaw { /// /// Adjustments for this plan. If the plan has phases, this includes adjustments /// across all phases of the plan. /// - public required Generic::List Adjustments + public required List Adjustments { get { - if (!this.Properties.TryGetValue("adjustments", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustments", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustments", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustments", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustments"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("adjustments"); } - set { this.Properties["adjustments"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustments"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List? PlanPhases + public required List? PlanPhases { get { - if (!this.Properties.TryGetValue("plan_phases", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "plan_phases", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("plan_phases", out JsonElement element)) + throw new ArgumentOutOfRangeException("plan_phases", "Missing required argument"); - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["plan_phases"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan_phases"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices for this plan. If the plan has phases, this includes prices across all /// phases of the plan. /// - public required Generic::List Prices + public required List Prices { get { - if (!this.Properties.TryGetValue("prices", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "prices", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("prices", out JsonElement element)) + throw new ArgumentOutOfRangeException("prices", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("prices"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("prices"); } - set { this.Properties["prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["prices"] = JsonSerializer.SerializeToElement(value); } } public required long Version { get { - if (!this.Properties.TryGetValue("version", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "version", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("version", out JsonElement element)) + throw new ArgumentOutOfRangeException("version", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["version"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -123,16 +105,14 @@ public override void Validate() public PlanVersion() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanVersion(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanVersion(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PlanVersion FromRawUnchecked( - Generic::Dictionary properties - ) + public static PlanVersion FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/PlanVersionPhase.cs b/src/Orb/Models/Beta/PlanVersionPhase.cs index 7c6a253d..f219e417 100644 --- a/src/Orb/Models/Beta/PlanVersionPhase.cs +++ b/src/Orb/Models/Beta/PlanVersionPhase.cs @@ -1,42 +1,38 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanVersionPhaseProperties = Orb.Models.Beta.PlanVersionPhaseProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Beta; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PlanVersionPhase : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PlanVersionPhase : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "description", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("description", out JsonElement element)) + throw new ArgumentOutOfRangeException("description", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -47,45 +43,37 @@ public required long? Duration { get { - if (!this.Properties.TryGetValue("duration", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "duration", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("duration", out JsonElement element)) + throw new ArgumentOutOfRangeException("duration", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration"] = JsonSerializer.SerializeToElement(value); } } public required PlanVersionPhaseProperties::DurationUnit? DurationUnit { get { - if (!this.Properties.TryGetValue("duration_unit", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "duration_unit", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize( - element - ); + if (!this.Properties.TryGetValue("duration_unit", out JsonElement element)) + throw new ArgumentOutOfRangeException("duration_unit", "Missing required argument"); + + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration_unit"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,12 +83,12 @@ public required long Order { get { - if (!this.Properties.TryGetValue("order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("order", "Missing required argument"); + if (!this.Properties.TryGetValue("order", out JsonElement element)) + throw new ArgumentOutOfRangeException("order", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["order"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -116,16 +104,14 @@ public override void Validate() public PlanVersionPhase() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanVersionPhase(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanVersionPhase(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PlanVersionPhase FromRawUnchecked( - Generic::Dictionary properties - ) + public static PlanVersionPhase FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Beta/PlanVersionPhaseProperties/DurationUnit.cs b/src/Orb/Models/Beta/PlanVersionPhaseProperties/DurationUnit.cs index 190bb71a..4c7a01d1 100644 --- a/src/Orb/Models/Beta/PlanVersionPhaseProperties/DurationUnit.cs +++ b/src/Orb/Models/Beta/PlanVersionPhaseProperties/DurationUnit.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.PlanVersionPhaseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DurationUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DurationUnit(string value) : IEnum { public static readonly DurationUnit Daily = new("daily"); @@ -36,7 +35,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Beta/PlanVersionProperties/Adjustment.cs b/src/Orb/Models/Beta/PlanVersionProperties/Adjustment.cs index 7912e29e..08b53047 100644 --- a/src/Orb/Models/Beta/PlanVersionProperties/Adjustment.cs +++ b/src/Orb/Models/Beta/PlanVersionProperties/Adjustment.cs @@ -1,34 +1,27 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Beta.PlanVersionProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Beta.PlanVersionProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::PlanPhaseUsageDiscountAdjustment Create( - Models::PlanPhaseUsageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseUsageDiscountAdjustment value) => + new AdjustmentVariants::PlanPhaseUsageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseAmountDiscountAdjustment Create( - Models::PlanPhaseAmountDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseAmountDiscountAdjustment value) => + new AdjustmentVariants::PlanPhaseAmountDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhasePercentageDiscountAdjustment Create( - Models::PlanPhasePercentageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhasePercentageDiscountAdjustment value) => + new AdjustmentVariants::PlanPhasePercentageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseMinimumAdjustment Create( - Models::PlanPhaseMinimumAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseMinimumAdjustment value) => + new AdjustmentVariants::PlanPhaseMinimumAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseMaximumAdjustment Create( - Models::PlanPhaseMaximumAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseMaximumAdjustment value) => + new AdjustmentVariants::PlanPhaseMaximumAdjustmentVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Beta/PlanVersionProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Beta/PlanVersionProperties/AdjustmentVariants/All.cs index e25eaff4..dc446e8b 100644 --- a/src/Orb/Models/Beta/PlanVersionProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Beta/PlanVersionProperties/AdjustmentVariants/All.cs @@ -1,24 +1,19 @@ -using Models = Orb.Models; -using Orb = Orb; -using PlanVersionProperties = Orb.Models.Beta.PlanVersionProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Beta.PlanVersionProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhaseUsageDiscountAdjustment, - Models::PlanPhaseUsageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhaseUsageDiscountAdjustmentVariant, + PlanPhaseUsageDiscountAdjustment >) )] -public sealed record class PlanPhaseUsageDiscountAdjustment( - Models::PlanPhaseUsageDiscountAdjustment Value -) - : PlanVersionProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseUsageDiscountAdjustmentVariant( + PlanPhaseUsageDiscountAdjustment Value +) : Adjustment, IVariant { - public static PlanPhaseUsageDiscountAdjustment From( - Models::PlanPhaseUsageDiscountAdjustment value + public static PlanPhaseUsageDiscountAdjustmentVariant From( + PlanPhaseUsageDiscountAdjustment value ) { return new(value); @@ -30,20 +25,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhaseAmountDiscountAdjustment, - Models::PlanPhaseAmountDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhaseAmountDiscountAdjustmentVariant, + PlanPhaseAmountDiscountAdjustment >) )] -public sealed record class PlanPhaseAmountDiscountAdjustment( - Models::PlanPhaseAmountDiscountAdjustment Value +public sealed record class PlanPhaseAmountDiscountAdjustmentVariant( + PlanPhaseAmountDiscountAdjustment Value ) - : PlanVersionProperties::Adjustment, - Orb::IVariant + : Adjustment, + IVariant { - public static PlanPhaseAmountDiscountAdjustment From( - Models::PlanPhaseAmountDiscountAdjustment value + public static PlanPhaseAmountDiscountAdjustmentVariant From( + PlanPhaseAmountDiscountAdjustment value ) { return new(value); @@ -55,23 +50,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhasePercentageDiscountAdjustment, - Models::PlanPhasePercentageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhasePercentageDiscountAdjustmentVariant, + PlanPhasePercentageDiscountAdjustment >) )] -public sealed record class PlanPhasePercentageDiscountAdjustment( - Models::PlanPhasePercentageDiscountAdjustment Value +public sealed record class PlanPhasePercentageDiscountAdjustmentVariant( + PlanPhasePercentageDiscountAdjustment Value ) - : PlanVersionProperties::Adjustment, - Orb::IVariant< - PlanPhasePercentageDiscountAdjustment, - Models::PlanPhasePercentageDiscountAdjustment + : Adjustment, + IVariant< + PlanPhasePercentageDiscountAdjustmentVariant, + PlanPhasePercentageDiscountAdjustment > { - public static PlanPhasePercentageDiscountAdjustment From( - Models::PlanPhasePercentageDiscountAdjustment value + public static PlanPhasePercentageDiscountAdjustmentVariant From( + PlanPhasePercentageDiscountAdjustment value ) { return new(value); @@ -83,14 +78,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PlanPhaseMinimumAdjustment(Models::PlanPhaseMinimumAdjustment Value) - : PlanVersionProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseMinimumAdjustmentVariant(PlanPhaseMinimumAdjustment Value) + : Adjustment, + IVariant { - public static PlanPhaseMinimumAdjustment From(Models::PlanPhaseMinimumAdjustment value) + public static PlanPhaseMinimumAdjustmentVariant From(PlanPhaseMinimumAdjustment value) { return new(value); } @@ -101,14 +96,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PlanPhaseMaximumAdjustment(Models::PlanPhaseMaximumAdjustment Value) - : PlanVersionProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseMaximumAdjustmentVariant(PlanPhaseMaximumAdjustment Value) + : Adjustment, + IVariant { - public static PlanPhaseMaximumAdjustment From(Models::PlanPhaseMaximumAdjustment value) + public static PlanPhaseMaximumAdjustmentVariant From(PlanPhaseMaximumAdjustment value) { return new(value); } diff --git a/src/Orb/Models/BillableMetricTiny.cs b/src/Orb/Models/BillableMetricTiny.cs index 7244405c..d67ee0f0 100644 --- a/src/Orb/Models/BillableMetricTiny.cs +++ b/src/Orb/Models/BillableMetricTiny.cs @@ -1,26 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BillableMetricTiny : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BillableMetricTiny : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -31,16 +30,14 @@ public override void Validate() public BillableMetricTiny() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BillableMetricTiny(Generic::Dictionary properties) + [SetsRequiredMembers] + BillableMetricTiny(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BillableMetricTiny FromRawUnchecked( - Generic::Dictionary properties - ) + public static BillableMetricTiny FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/BillingCycleAnchorConfiguration.cs b/src/Orb/Models/BillingCycleAnchorConfiguration.cs index c87da2f2..9fac9726 100644 --- a/src/Orb/Models/BillingCycleAnchorConfiguration.cs +++ b/src/Orb/Models/BillingCycleAnchorConfiguration.cs @@ -1,16 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class BillingCycleAnchorConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The day of the month on which the billing cycle is anchored. If the maximum @@ -22,12 +21,12 @@ public required long Day { get { - if (!this.Properties.TryGetValue("day", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("day", out JsonElement element)) throw new System::ArgumentOutOfRangeException("day", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["day"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["day"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,12 +37,12 @@ public long? Month { get { - if (!this.Properties.TryGetValue("month", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("month", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["month"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["month"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +53,12 @@ public long? Year { get { - if (!this.Properties.TryGetValue("year", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("year", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["year"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["year"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -72,15 +71,15 @@ public override void Validate() public BillingCycleAnchorConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BillingCycleAnchorConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + BillingCycleAnchorConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BillingCycleAnchorConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/BillingCycleConfiguration.cs b/src/Orb/Models/BillingCycleConfiguration.cs index 7394e479..ab1a0b2a 100644 --- a/src/Orb/Models/BillingCycleConfiguration.cs +++ b/src/Orb/Models/BillingCycleConfiguration.cs @@ -1,48 +1,47 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BillingCycleConfigurationProperties = Orb.Models.BillingCycleConfigurationProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class BillingCycleConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required long Duration { get { - if (!this.Properties.TryGetValue("duration", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "duration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration"] = JsonSerializer.SerializeToElement(value); } } public required BillingCycleConfigurationProperties::DurationUnit DurationUnit { get { - if (!this.Properties.TryGetValue("duration_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "duration_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("duration_unit"); } - set { this.Properties["duration_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,15 +53,15 @@ public override void Validate() public BillingCycleConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BillingCycleConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + BillingCycleConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BillingCycleConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/BillingCycleConfigurationProperties/DurationUnit.cs b/src/Orb/Models/BillingCycleConfigurationProperties/DurationUnit.cs index 30616f2c..9d89acc4 100644 --- a/src/Orb/Models/BillingCycleConfigurationProperties/DurationUnit.cs +++ b/src/Orb/Models/BillingCycleConfigurationProperties/DurationUnit.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.BillingCycleConfigurationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DurationUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DurationUnit(string value) : IEnum { public static readonly DurationUnit Day = new("day"); @@ -24,7 +23,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/BillingCycleRelativeDate.cs b/src/Orb/Models/BillingCycleRelativeDate.cs index 1290616e..5fb27a3b 100644 --- a/src/Orb/Models/BillingCycleRelativeDate.cs +++ b/src/Orb/Models/BillingCycleRelativeDate.cs @@ -1,12 +1,11 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] +[JsonConverter(typeof(EnumConverter))] public sealed record class BillingCycleRelativeDate(string value) - : Orb::IEnum + : IEnum { public static readonly BillingCycleRelativeDate StartOfTerm = new("start_of_term"); diff --git a/src/Orb/Models/BulkBPSConfig.cs b/src/Orb/Models/BulkBPSConfig.cs index cd7e2c3e..a1e37bc3 100644 --- a/src/Orb/Models/BulkBPSConfig.cs +++ b/src/Orb/Models/BulkBPSConfig.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BulkBPSConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BulkBPSConfig : ModelBase, IFromRaw { /// /// Tiers for a bulk BPS pricing model where all usage is aggregated to a single /// tier based on total volume /// - public required Generic::List Tiers + public required List Tiers { get { - if (!this.Properties.TryGetValue("tiers", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiers", out JsonElement element)) throw new System::ArgumentOutOfRangeException("tiers", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tiers"); } - set { this.Properties["tiers"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiers"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -38,16 +37,14 @@ public override void Validate() public BulkBPSConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BulkBPSConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + BulkBPSConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BulkBPSConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static BulkBPSConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/BulkBPSTier.cs b/src/Orb/Models/BulkBPSTier.cs index 6884146c..e237d303 100644 --- a/src/Orb/Models/BulkBPSTier.cs +++ b/src/Orb/Models/BulkBPSTier.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BulkBPSTier : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BulkBPSTier : ModelBase, IFromRaw { /// /// Basis points to rate on @@ -17,12 +16,12 @@ public required double BPS { get { - if (!this.Properties.TryGetValue("bps", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bps", out JsonElement element)) throw new System::ArgumentOutOfRangeException("bps", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["bps"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps"] = JsonSerializer.SerializeToElement(value); } } /// @@ -32,12 +31,12 @@ public string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -47,15 +46,12 @@ public string? PerUnitMaximum { get { - if (!this.Properties.TryGetValue("per_unit_maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_unit_maximum", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_maximum"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_maximum"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -68,16 +64,14 @@ public override void Validate() public BulkBPSTier() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BulkBPSTier(Generic::Dictionary properties) + [SetsRequiredMembers] + BulkBPSTier(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BulkBPSTier FromRawUnchecked( - Generic::Dictionary properties - ) + public static BulkBPSTier FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/BulkConfig.cs b/src/Orb/Models/BulkConfig.cs index 64bbdd89..384bb77f 100644 --- a/src/Orb/Models/BulkConfig.cs +++ b/src/Orb/Models/BulkConfig.cs @@ -1,29 +1,28 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BulkConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BulkConfig : ModelBase, IFromRaw { /// /// Bulk tiers for rating based on total usage volume /// - public required Generic::List Tiers + public required List Tiers { get { - if (!this.Properties.TryGetValue("tiers", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiers", out JsonElement element)) throw new System::ArgumentOutOfRangeException("tiers", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tiers"); } - set { this.Properties["tiers"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiers"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +36,14 @@ public override void Validate() public BulkConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BulkConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + BulkConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BulkConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static BulkConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/BulkTier.cs b/src/Orb/Models/BulkTier.cs index a5f831cd..d0aff49e 100644 --- a/src/Orb/Models/BulkTier.cs +++ b/src/Orb/Models/BulkTier.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BulkTier : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BulkTier : ModelBase, IFromRaw { /// /// Amount per unit @@ -17,16 +16,16 @@ public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,12 +35,12 @@ public double? MaximumUnits { get { - if (!this.Properties.TryGetValue("maximum_units", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_units", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_units"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_units"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -53,16 +52,14 @@ public override void Validate() public BulkTier() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BulkTier(Generic::Dictionary properties) + [SetsRequiredMembers] + BulkTier(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BulkTier FromRawUnchecked( - Generic::Dictionary properties - ) + public static BulkTier FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/ChangedSubscriptionResources.cs b/src/Orb/Models/ChangedSubscriptionResources.cs index 4f43a667..cc8d4758 100644 --- a/src/Orb/Models/ChangedSubscriptionResources.cs +++ b/src/Orb/Models/ChangedSubscriptionResources.cs @@ -1,102 +1,90 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class ChangedSubscriptionResources - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The credit notes that were created as part of this operation. /// - public required Generic::List CreatedCreditNotes + public required List CreatedCreditNotes { get { - if (!this.Properties.TryGetValue("created_credit_notes", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_credit_notes", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_credit_notes", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("created_credit_notes"); } - set - { - this.Properties["created_credit_notes"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["created_credit_notes"] = JsonSerializer.SerializeToElement(value); } } /// /// The invoices that were created as part of this operation. /// - public required Generic::List CreatedInvoices + public required List CreatedInvoices { get { - if (!this.Properties.TryGetValue("created_invoices", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_invoices", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_invoices", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("created_invoices"); } - set - { - this.Properties["created_invoices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["created_invoices"] = JsonSerializer.SerializeToElement(value); } } /// /// The credit notes that were voided as part of this operation. /// - public required Generic::List VoidedCreditNotes + public required List VoidedCreditNotes { get { - if (!this.Properties.TryGetValue("voided_credit_notes", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_credit_notes", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_credit_notes", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("voided_credit_notes"); } - set - { - this.Properties["voided_credit_notes"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["voided_credit_notes"] = JsonSerializer.SerializeToElement(value); } } /// /// The invoices that were voided as part of this operation. /// - public required Generic::List VoidedInvoices + public required List VoidedInvoices { get { - if (!this.Properties.TryGetValue("voided_invoices", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_invoices", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_invoices", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("voided_invoices"); } - set { this.Properties["voided_invoices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["voided_invoices"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -122,15 +110,15 @@ public override void Validate() public ChangedSubscriptionResources() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ChangedSubscriptionResources(Generic::Dictionary properties) + [SetsRequiredMembers] + ChangedSubscriptionResources(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ChangedSubscriptionResources FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/ConversionRateTier.cs b/src/Orb/Models/ConversionRateTier.cs index 917a21fd..001ddb3d 100644 --- a/src/Orb/Models/ConversionRateTier.cs +++ b/src/Orb/Models/ConversionRateTier.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ConversionRateTier : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ConversionRateTier : ModelBase, IFromRaw { /// /// Exclusive tier starting value @@ -17,15 +16,15 @@ public required double FirstUnit { get { - if (!this.Properties.TryGetValue("first_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("first_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "first_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["first_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["first_unit"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,16 +34,16 @@ public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +53,12 @@ public double? LastUnit { get { - if (!this.Properties.TryGetValue("last_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("last_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["last_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["last_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -72,16 +71,14 @@ public override void Validate() public ConversionRateTier() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ConversionRateTier(Generic::Dictionary properties) + [SetsRequiredMembers] + ConversionRateTier(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ConversionRateTier FromRawUnchecked( - Generic::Dictionary properties - ) + public static ConversionRateTier FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/ConversionRateTieredConfig.cs b/src/Orb/Models/ConversionRateTieredConfig.cs index aabcfebe..90e6221d 100644 --- a/src/Orb/Models/ConversionRateTieredConfig.cs +++ b/src/Orb/Models/ConversionRateTieredConfig.cs @@ -1,31 +1,30 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class ConversionRateTieredConfig - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// Tiers for rating based on total usage quantities into the specified tier /// - public required Generic::List Tiers + public required List Tiers { get { - if (!this.Properties.TryGetValue("tiers", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiers", out JsonElement element)) throw new System::ArgumentOutOfRangeException("tiers", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tiers"); } - set { this.Properties["tiers"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiers"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -39,15 +38,15 @@ public override void Validate() public ConversionRateTieredConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ConversionRateTieredConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + ConversionRateTieredConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ConversionRateTieredConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/ConversionRateUnitConfig.cs b/src/Orb/Models/ConversionRateUnitConfig.cs index a6ca5803..4ab60f08 100644 --- a/src/Orb/Models/ConversionRateUnitConfig.cs +++ b/src/Orb/Models/ConversionRateUnitConfig.cs @@ -1,16 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ConversionRateUnitConfig - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ConversionRateUnitConfig : ModelBase, IFromRaw { /// /// Amount per unit of overage @@ -19,16 +16,16 @@ public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -39,15 +36,15 @@ public override void Validate() public ConversionRateUnitConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ConversionRateUnitConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + ConversionRateUnitConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ConversionRateUnitConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/CouponRedemption.cs b/src/Orb/Models/CouponRedemption.cs index 29609225..59b0f859 100644 --- a/src/Orb/Models/CouponRedemption.cs +++ b/src/Orb/Models/CouponRedemption.cs @@ -1,59 +1,58 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CouponRedemption : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CouponRedemption : ModelBase, IFromRaw { public required string CouponID { get { - if (!this.Properties.TryGetValue("coupon_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("coupon_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "coupon_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("coupon_id"); } - set { this.Properties["coupon_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["coupon_id"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -66,16 +65,14 @@ public override void Validate() public CouponRedemption() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CouponRedemption(Generic::Dictionary properties) + [SetsRequiredMembers] + CouponRedemption(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CouponRedemption FromRawUnchecked( - Generic::Dictionary properties - ) + public static CouponRedemption FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Coupons/Coupon.cs b/src/Orb/Models/Coupons/Coupon.cs index 2ccca081..5f527dea 100644 --- a/src/Orb/Models/Coupons/Coupon.cs +++ b/src/Orb/Models/Coupons/Coupon.cs @@ -1,10 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CouponProperties = Orb.Models.Coupons.CouponProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Coupons; @@ -15,8 +14,8 @@ namespace Orb.Models.Coupons; /// The duration of a coupon determines how long it remains available for use by /// end users. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Coupon : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Coupon : ModelBase, IFromRaw { /// /// Also referred to as coupon_id in this documentation. @@ -25,48 +24,42 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// An archived coupon can no longer be redeemed. Active coupons will have a value /// of null for `archived_at`; this field will be non-null for archived coupons. /// - public required System::DateTime? ArchivedAt + public required DateTime? ArchivedAt { get { - if (!this.Properties.TryGetValue("archived_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "archived_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("archived_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("archived_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["archived_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["archived_at"] = JsonSerializer.SerializeToElement(value); } } public required CouponProperties::Discount Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("discount"); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,18 +70,15 @@ public required long? DurationInMonths { get { - if (!this.Properties.TryGetValue("duration_in_months", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("duration_in_months", out JsonElement element)) + throw new ArgumentOutOfRangeException( "duration_in_months", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["duration_in_months"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["duration_in_months"] = JsonSerializer.SerializeToElement(value); } } /// @@ -99,15 +89,15 @@ public required long? MaxRedemptions { get { - if (!this.Properties.TryGetValue("max_redemptions", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("max_redemptions", out JsonElement element)) + throw new ArgumentOutOfRangeException( "max_redemptions", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["max_redemptions"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["max_redemptions"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,16 +107,16 @@ public required string RedemptionCode { get { - if (!this.Properties.TryGetValue("redemption_code", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("redemption_code", out JsonElement element)) + throw new ArgumentOutOfRangeException( "redemption_code", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("redemption_code"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("redemption_code"); } - set { this.Properties["redemption_code"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["redemption_code"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,15 +126,15 @@ public required long TimesRedeemed { get { - if (!this.Properties.TryGetValue("times_redeemed", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("times_redeemed", out JsonElement element)) + throw new ArgumentOutOfRangeException( "times_redeemed", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["times_redeemed"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["times_redeemed"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -161,14 +151,14 @@ public override void Validate() public Coupon() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Coupon(Generic::Dictionary properties) + [SetsRequiredMembers] + Coupon(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Coupon FromRawUnchecked(Generic::Dictionary properties) + public static Coupon FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Coupons/CouponArchiveParams.cs b/src/Orb/Models/Coupons/CouponArchiveParams.cs index 27ff7724..fa1aae78 100644 --- a/src/Orb/Models/Coupons/CouponArchiveParams.cs +++ b/src/Orb/Models/Coupons/CouponArchiveParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Coupons; @@ -9,13 +8,13 @@ namespace Orb.Models.Coupons; /// be redeemed, and will be hidden from lists of active coupons. Additionally, once /// a coupon is archived, its redemption code can be reused for a different coupon. /// -public sealed record class CouponArchiveParams : Orb::ParamsBase +public sealed record class CouponArchiveParams : ParamsBase { public required string CouponID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/coupons/{0}/archive", this.CouponID) ) @@ -24,12 +23,12 @@ public sealed record class CouponArchiveParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Coupons/CouponCreateParams.cs b/src/Orb/Models/Coupons/CouponCreateParams.cs index ec35c3ab..5389c8e2 100644 --- a/src/Orb/Models/Coupons/CouponCreateParams.cs +++ b/src/Orb/Models/Coupons/CouponCreateParams.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using CouponCreateParamsProperties = Orb.Models.Coupons.CouponCreateParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; namespace Orb.Models.Coupons; @@ -12,24 +11,21 @@ namespace Orb.Models.Coupons; /// This endpoint allows the creation of coupons, which can then be redeemed at subscription /// creation or plan change. /// -public sealed record class CouponCreateParams : Orb::ParamsBase +public sealed record class CouponCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required CouponCreateParamsProperties::Discount Discount { get { - if (!this.BodyProperties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("discount"); } - set { this.BodyProperties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -39,19 +35,16 @@ public required string RedemptionCode { get { - if (!this.BodyProperties.TryGetValue("redemption_code", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("redemption_code", out JsonElement element)) + throw new ArgumentOutOfRangeException( "redemption_code", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("redemption_code"); - } - set - { - this.BodyProperties["redemption_code"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("redemption_code"); } + set { this.BodyProperties["redemption_code"] = JsonSerializer.SerializeToElement(value); } } /// @@ -62,21 +55,14 @@ public long? DurationInMonths { get { - if ( - !this.BodyProperties.TryGetValue( - "duration_in_months", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("duration_in_months", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["duration_in_months"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["duration_in_months"] = JsonSerializer.SerializeToElement(value); } } @@ -88,40 +74,37 @@ public long? MaxRedemptions { get { - if (!this.BodyProperties.TryGetValue("max_redemptions", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("max_redemptions", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["max_redemptions"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["max_redemptions"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/coupons") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/coupons") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Coupons/CouponCreateParamsProperties/Discount.cs b/src/Orb/Models/Coupons/CouponCreateParamsProperties/Discount.cs index c0b8fc77..f12825a9 100644 --- a/src/Orb/Models/Coupons/CouponCreateParamsProperties/Discount.cs +++ b/src/Orb/Models/Coupons/CouponCreateParamsProperties/Discount.cs @@ -1,19 +1,19 @@ +using System.Text.Json.Serialization; using DiscountProperties = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties; using DiscountVariants = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Coupons.CouponCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Discount { internal Discount() { } - public static DiscountVariants::Percentage Create(DiscountProperties::Percentage value) => - new(value); + public static implicit operator Discount(DiscountProperties::Percentage value) => + new DiscountVariants::Percentage(value); - public static DiscountVariants::Amount Create(DiscountProperties::Amount value) => new(value); + public static implicit operator Discount(DiscountProperties::Amount value) => + new DiscountVariants::Amount(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Amount.cs b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Amount.cs index 60e4c6ce..6dae0b4f 100644 --- a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Amount.cs +++ b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Amount.cs @@ -1,65 +1,61 @@ -using AmountProperties = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties.AmountProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Amount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Amount : ModelBase, IFromRaw { public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount_discount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount_discount"); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } - public required AmountProperties::DiscountType DiscountType + public JsonElement DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.AmountDiscount; - this.DiscountType.Validate(); } - public Amount() { } + public Amount() + { + this.DiscountType = JsonSerializer.Deserialize("\"amount\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Amount(Generic::Dictionary properties) + [SetsRequiredMembers] + Amount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Amount FromRawUnchecked(Generic::Dictionary properties) + public static Amount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/AmountProperties/DiscountType.cs b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/AmountProperties/DiscountType.cs deleted file mode 100644 index 29c8d648..00000000 --- a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/AmountProperties/DiscountType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties.AmountProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum -{ - public static readonly DiscountType Amount = new("amount"); - - readonly string _value = value; - - public enum Value - { - Amount, - } - - public Value Known() => - _value switch - { - "amount" => Value.Amount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static DiscountType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Percentage.cs b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Percentage.cs index db105616..15cec1cd 100644 --- a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Percentage.cs +++ b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/Percentage.cs @@ -1,69 +1,60 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using PercentageProperties = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties.PercentageProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Percentage : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Percentage : ModelBase, IFromRaw { - public required PercentageProperties::DiscountType DiscountType + public JsonElement DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { - this.DiscountType.Validate(); _ = this.PercentageDiscount; } - public Percentage() { } + public Percentage() + { + this.DiscountType = JsonSerializer.Deserialize("\"percentage\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Percentage(Generic::Dictionary properties) + [SetsRequiredMembers] + Percentage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Percentage FromRawUnchecked( - Generic::Dictionary properties - ) + public static Percentage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/PercentageProperties/DiscountType.cs b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/PercentageProperties/DiscountType.cs deleted file mode 100644 index fd1a73b2..00000000 --- a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountProperties/PercentageProperties/DiscountType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties.PercentageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum -{ - public static readonly DiscountType Percentage = new("percentage"); - - readonly string _value = value; - - public enum Value - { - Percentage, - } - - public Value Known() => - _value switch - { - "percentage" => Value.Percentage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static DiscountType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountVariants/All.cs b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountVariants/All.cs index 161bf4c0..d8ad46a0 100644 --- a/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountVariants/All.cs +++ b/src/Orb/Models/Coupons/CouponCreateParamsProperties/DiscountVariants/All.cs @@ -1,16 +1,12 @@ -using CouponCreateParamsProperties = Orb.Models.Coupons.CouponCreateParamsProperties; +using System.Text.Json.Serialization; using DiscountProperties = Orb.Models.Coupons.CouponCreateParamsProperties.DiscountProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Coupons.CouponCreateParamsProperties.DiscountVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class Percentage(DiscountProperties::Percentage Value) - : CouponCreateParamsProperties::Discount, - Orb::IVariant + : Discount, + IVariant { public static Percentage From(DiscountProperties::Percentage value) { @@ -23,10 +19,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Amount(DiscountProperties::Amount Value) - : CouponCreateParamsProperties::Discount, - Orb::IVariant + : Discount, + IVariant { public static Amount From(DiscountProperties::Amount value) { diff --git a/src/Orb/Models/Coupons/CouponFetchParams.cs b/src/Orb/Models/Coupons/CouponFetchParams.cs index 590cd97e..d4f057a3 100644 --- a/src/Orb/Models/Coupons/CouponFetchParams.cs +++ b/src/Orb/Models/Coupons/CouponFetchParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Coupons; @@ -8,13 +7,13 @@ namespace Orb.Models.Coupons; /// This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption /// code, use the [List coupons](list-coupons) endpoint with the redemption_code parameter. /// -public sealed record class CouponFetchParams : Orb::ParamsBase +public sealed record class CouponFetchParams : ParamsBase { public required string CouponID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/coupons/{0}", this.CouponID) ) { @@ -22,12 +21,12 @@ public sealed record class CouponFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Coupons/CouponListPageResponse.cs b/src/Orb/Models/Coupons/CouponListPageResponse.cs index d03528f2..bc7800da 100644 --- a/src/Orb/Models/Coupons/CouponListPageResponse.cs +++ b/src/Orb/Models/Coupons/CouponListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Coupons; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CouponListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CouponListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,15 +51,15 @@ public override void Validate() public CouponListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CouponListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CouponListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CouponListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Coupons/CouponListParams.cs b/src/Orb/Models/Coupons/CouponListParams.cs index 58eb50e1..9a732413 100644 --- a/src/Orb/Models/Coupons/CouponListParams.cs +++ b/src/Orb/Models/Coupons/CouponListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Coupons; @@ -13,7 +12,7 @@ namespace Orb.Models.Coupons; /// the next page of results if they exist. More information about pagination can /// be found in the Pagination-metadata schema. /// -public sealed record class CouponListParams : Orb::ParamsBase +public sealed record class CouponListParams : ParamsBase { /// /// Cursor for pagination. This can be populated by the `next_cursor` value returned @@ -23,12 +22,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,12 +37,12 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,17 +52,12 @@ public string? RedemptionCode { get { - if (!this.QueryProperties.TryGetValue("redemption_code", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("redemption_code", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["redemption_code"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["redemption_code"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,31 +67,28 @@ public bool? ShowArchived { get { - if (!this.QueryProperties.TryGetValue("show_archived", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("show_archived", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["show_archived"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["show_archived"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/coupons") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/coupons") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Coupons/CouponProperties/Discount.cs b/src/Orb/Models/Coupons/CouponProperties/Discount.cs index 89cd34fa..91bec1a9 100644 --- a/src/Orb/Models/Coupons/CouponProperties/Discount.cs +++ b/src/Orb/Models/Coupons/CouponProperties/Discount.cs @@ -1,20 +1,18 @@ +using System.Text.Json.Serialization; using DiscountVariants = Orb.Models.Coupons.CouponProperties.DiscountVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Coupons.CouponProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Discount { internal Discount() { } - public static DiscountVariants::PercentageDiscount Create(Models::PercentageDiscount value) => - new(value); + public static implicit operator Discount(PercentageDiscount value) => + new DiscountVariants::PercentageDiscountVariant(value); - public static DiscountVariants::AmountDiscount Create(Models::AmountDiscount value) => - new(value); + public static implicit operator Discount(AmountDiscount value) => + new DiscountVariants::AmountDiscountVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Coupons/CouponProperties/DiscountVariants/All.cs b/src/Orb/Models/Coupons/CouponProperties/DiscountVariants/All.cs index ca6b8eef..2aa2a149 100644 --- a/src/Orb/Models/Coupons/CouponProperties/DiscountVariants/All.cs +++ b/src/Orb/Models/Coupons/CouponProperties/DiscountVariants/All.cs @@ -1,18 +1,13 @@ -using CouponProperties = Orb.Models.Coupons.CouponProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Coupons.CouponProperties.DiscountVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class PercentageDiscount(Models::PercentageDiscount Value) - : CouponProperties::Discount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class PercentageDiscountVariant(PercentageDiscount Value) + : Discount, + IVariant { - public static PercentageDiscount From(Models::PercentageDiscount value) + public static PercentageDiscountVariant From(PercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmountDiscount(Models::AmountDiscount Value) - : CouponProperties::Discount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmountDiscountVariant(AmountDiscount Value) + : Discount, + IVariant { - public static AmountDiscount From(Models::AmountDiscount value) + public static AmountDiscountVariant From(AmountDiscount value) { return new(value); } diff --git a/src/Orb/Models/Coupons/Subscriptions/SubscriptionListParams.cs b/src/Orb/Models/Coupons/Subscriptions/SubscriptionListParams.cs index 0d75346c..7afe9913 100644 --- a/src/Orb/Models/Coupons/Subscriptions/SubscriptionListParams.cs +++ b/src/Orb/Models/Coupons/Subscriptions/SubscriptionListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Coupons.Subscriptions; @@ -11,7 +10,7 @@ namespace Orb.Models.Coupons.Subscriptions; /// the most recently created subscription. For a full discussion of the subscription /// resource, see [Subscription](/core-concepts#subscription). /// -public sealed record class SubscriptionListParams : Orb::ParamsBase +public sealed record class SubscriptionListParams : ParamsBase { public required string CouponID; @@ -23,12 +22,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,17 +37,17 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/coupons/{0}/subscriptions", this.CouponID) ) @@ -57,12 +56,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/CreditNote.cs b/src/Orb/Models/CreditNote.cs index 2ba4c375..70c213db 100644 --- a/src/Orb/Models/CreditNote.cs +++ b/src/Orb/Models/CreditNote.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CreditNoteProperties = Orb.Models.CreditNoteProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; @@ -12,8 +11,8 @@ namespace Orb.Models; /// The [Credit Note](/invoicing/credit-notes) resource represents a credit that has /// been applied to a particular invoice. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CreditNote : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CreditNote : ModelBase, IFromRaw { /// /// The Orb id of this credit note. @@ -22,13 +21,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,15 +37,15 @@ public required string ID { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -56,19 +55,16 @@ public required string CreditNoteNumber { get { - if (!this.Properties.TryGetValue("credit_note_number", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_note_number"); } - set - { - this.Properties["credit_note_number"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["credit_note_number"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,31 +74,31 @@ public required string? CreditNotePdf { get { - if (!this.Properties.TryGetValue("credit_note_pdf", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note_pdf", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note_pdf", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["credit_note_pdf"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_note_pdf"] = JsonSerializer.SerializeToElement(value); } } public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } /// @@ -112,36 +108,35 @@ public required string InvoiceID { get { - if (!this.Properties.TryGetValue("invoice_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("invoice_id"); } - set { this.Properties["invoice_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_id"] = JsonSerializer.SerializeToElement(value); } } /// /// All of the line items associated with this credit note. /// - public required Generic::List LineItems + public required List LineItems { get { - if (!this.Properties.TryGetValue("line_items", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line_items", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("line_items"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("line_items"); } - set { this.Properties["line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line_items"] = JsonSerializer.SerializeToElement(value); } } /// @@ -151,26 +146,19 @@ public required string InvoiceID { get { - if ( - !this.Properties.TryGetValue( - "maximum_amount_adjustment", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("maximum_amount_adjustment", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount_adjustment", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["maximum_amount_adjustment"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["maximum_amount_adjustment"] = JsonSerializer.SerializeToElement(value); } } @@ -181,12 +169,12 @@ public required string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) throw new System::ArgumentOutOfRangeException("memo", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,24 +184,17 @@ public required string? MinimumAmountRefunded { get { - if ( - !this.Properties.TryGetValue( - "minimum_amount_refunded", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("minimum_amount_refunded", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount_refunded", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["minimum_amount_refunded"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["minimum_amount_refunded"] = JsonSerializer.SerializeToElement(value); } } @@ -221,15 +202,15 @@ public required string? MinimumAmountRefunded { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -239,16 +220,16 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -258,26 +239,26 @@ public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } public required CreditNoteProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -287,32 +268,30 @@ public required string Total { get { - if (!this.Properties.TryGetValue("voided_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["voided_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["voided_at"] = JsonSerializer.SerializeToElement(value); } } /// /// Any discounts applied on the original invoice. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -344,16 +323,14 @@ public override void Validate() public CreditNote() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditNote(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditNote(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CreditNote FromRawUnchecked( - Generic::Dictionary properties - ) + public static CreditNote FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNoteProperties/Discount.cs b/src/Orb/Models/CreditNoteProperties/Discount1.cs similarity index 50% rename from src/Orb/Models/CreditNoteProperties/Discount.cs rename to src/Orb/Models/CreditNoteProperties/Discount1.cs index f54f8808..832cca6d 100644 --- a/src/Orb/Models/CreditNoteProperties/Discount.cs +++ b/src/Orb/Models/CreditNoteProperties/Discount1.cs @@ -1,93 +1,84 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DiscountProperties = Orb.Models.CreditNoteProperties.DiscountProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.CreditNoteProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Discount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Discount1 : ModelBase, IFromRaw { public required string AmountApplied { get { - if (!this.Properties.TryGetValue("amount_applied", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_applied", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_applied", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_applied"); } - set { this.Properties["amount_applied"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_applied"] = JsonSerializer.SerializeToElement(value); } } public required DiscountProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } - public Generic::List? AppliesToPrices + public List? AppliesToPrices { get { - if (!this.Properties.TryGetValue("applies_to_prices", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); - } - set - { - this.Properties["applies_to_prices"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_prices"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -102,19 +93,17 @@ public override void Validate() _ = this.Reason; } - public Discount() { } + public Discount1() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Discount(Generic::Dictionary properties) + [SetsRequiredMembers] + Discount1(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Discount FromRawUnchecked( - Generic::Dictionary properties - ) + public static Discount1 FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNoteProperties/DiscountProperties/AppliesToPrice.cs b/src/Orb/Models/CreditNoteProperties/DiscountProperties/AppliesToPrice.cs index 75f3ba22..c02df181 100644 --- a/src/Orb/Models/CreditNoteProperties/DiscountProperties/AppliesToPrice.cs +++ b/src/Orb/Models/CreditNoteProperties/DiscountProperties/AppliesToPrice.cs @@ -1,39 +1,38 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNoteProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AppliesToPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AppliesToPrice : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -45,16 +44,14 @@ public override void Validate() public AppliesToPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AppliesToPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + AppliesToPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AppliesToPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static AppliesToPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNoteProperties/DiscountProperties/DiscountType.cs b/src/Orb/Models/CreditNoteProperties/DiscountProperties/DiscountType.cs index 21827570..5ff31e1a 100644 --- a/src/Orb/Models/CreditNoteProperties/DiscountProperties/DiscountType.cs +++ b/src/Orb/Models/CreditNoteProperties/DiscountProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNoteProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Percentage = new("percentage"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage" => Value.Percentage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/CreditNoteProperties/LineItem.cs b/src/Orb/Models/CreditNoteProperties/LineItem.cs index 0ed014db..70750629 100644 --- a/src/Orb/Models/CreditNoteProperties/LineItem.cs +++ b/src/Orb/Models/CreditNoteProperties/LineItem.cs @@ -1,16 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using LineItemProperties = Orb.Models.CreditNoteProperties.LineItemProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.CreditNoteProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class LineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class LineItem : ModelBase, IFromRaw { /// /// The Orb id of this resource. @@ -19,13 +17,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,16 +33,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,16 +52,16 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,13 +71,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -89,15 +87,15 @@ public required double? Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -107,52 +105,50 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// /// Any tax amounts applied onto the line item. /// - public required Generic::List TaxAmounts + public required List TaxAmounts { get { - if (!this.Properties.TryGetValue("tax_amounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_amounts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_amounts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tax_amounts"); } - set { this.Properties["tax_amounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_amounts"] = JsonSerializer.SerializeToElement(value); } } /// /// Any line item discounts from the invoice's line item. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -162,15 +158,12 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("end_time_exclusive", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_time_exclusive", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["end_time_exclusive"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["end_time_exclusive"] = JsonSerializer.SerializeToElement(value); } } /// @@ -180,17 +173,12 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("start_time_inclusive", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_time_inclusive", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["start_time_inclusive"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["start_time_inclusive"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -216,16 +204,14 @@ public override void Validate() public LineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + LineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static LineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static LineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNoteProperties/LineItemProperties/Discount.cs b/src/Orb/Models/CreditNoteProperties/LineItemProperties/Discount.cs index ae718e7f..ba8ece99 100644 --- a/src/Orb/Models/CreditNoteProperties/LineItemProperties/Discount.cs +++ b/src/Orb/Models/CreditNoteProperties/LineItemProperties/Discount.cs @@ -1,122 +1,110 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DiscountProperties = Orb.Models.CreditNoteProperties.LineItemProperties.DiscountProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.CreditNoteProperties.LineItemProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Discount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Discount : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string AmountApplied { get { - if (!this.Properties.TryGetValue("amount_applied", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("amount_applied", out JsonElement element)) + throw new ArgumentOutOfRangeException( "amount_applied", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount_applied"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount_applied"); } - set { this.Properties["amount_applied"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_applied"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) + throw new ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("applies_to_price_ids"); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("applies_to_price_ids"); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } public required DiscountProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } public string? AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -136,16 +124,14 @@ public override void Validate() public Discount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Discount(Generic::Dictionary properties) + [SetsRequiredMembers] + Discount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Discount FromRawUnchecked( - Generic::Dictionary properties - ) + public static Discount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNoteProperties/LineItemProperties/DiscountProperties/DiscountType.cs b/src/Orb/Models/CreditNoteProperties/LineItemProperties/DiscountProperties/DiscountType.cs index f45f295f..2fc77cb3 100644 --- a/src/Orb/Models/CreditNoteProperties/LineItemProperties/DiscountProperties/DiscountType.cs +++ b/src/Orb/Models/CreditNoteProperties/LineItemProperties/DiscountProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNoteProperties.LineItemProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Percentage = new("percentage"); @@ -24,7 +23,7 @@ public Value Known() => { "percentage" => Value.Percentage, "amount" => Value.Amount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustment.cs b/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustment.cs index 8d69e2f5..c9f978ef 100644 --- a/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustment.cs +++ b/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustment.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MaximumAmountAdjustmentProperties = Orb.Models.CreditNoteProperties.MaximumAmountAdjustmentProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.CreditNoteProperties; @@ -11,89 +10,81 @@ namespace Orb.Models.CreditNoteProperties; /// /// The maximum amount applied on the original invoice /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MaximumAmountAdjustment - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MaximumAmountAdjustment : ModelBase, IFromRaw { public required string AmountApplied { get { - if (!this.Properties.TryGetValue("amount_applied", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_applied", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_applied", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_applied"); } - set { this.Properties["amount_applied"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_applied"] = JsonSerializer.SerializeToElement(value); } } public required MaximumAmountAdjustmentProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } - public Generic::List? AppliesToPrices + public List? AppliesToPrices { get { - if (!this.Properties.TryGetValue("applies_to_prices", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.Properties["applies_to_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["applies_to_prices"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -111,15 +102,15 @@ public override void Validate() public MaximumAmountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MaximumAmountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + MaximumAmountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MaximumAmountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/AppliesToPrice.cs b/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/AppliesToPrice.cs index f7ece7ce..4db96f84 100644 --- a/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/AppliesToPrice.cs +++ b/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/AppliesToPrice.cs @@ -1,39 +1,38 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNoteProperties.MaximumAmountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AppliesToPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AppliesToPrice : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -45,16 +44,14 @@ public override void Validate() public AppliesToPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AppliesToPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + AppliesToPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AppliesToPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static AppliesToPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/DiscountType.cs b/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/DiscountType.cs index be6dc11e..f345de53 100644 --- a/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/DiscountType.cs +++ b/src/Orb/Models/CreditNoteProperties/MaximumAmountAdjustmentProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNoteProperties.MaximumAmountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Percentage = new("percentage"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage" => Value.Percentage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/CreditNoteProperties/Reason.cs b/src/Orb/Models/CreditNoteProperties/Reason.cs index 2d7c7d3b..b1d15188 100644 --- a/src/Orb/Models/CreditNoteProperties/Reason.cs +++ b/src/Orb/Models/CreditNoteProperties/Reason.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.CreditNoteProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Reason(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Reason(string value) : IEnum { public static readonly Reason Duplicate = new("Duplicate"); diff --git a/src/Orb/Models/CreditNoteProperties/Type.cs b/src/Orb/Models/CreditNoteProperties/Type.cs index db6c074e..6933d947 100644 --- a/src/Orb/Models/CreditNoteProperties/Type.cs +++ b/src/Orb/Models/CreditNoteProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.CreditNoteProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Refund = new("refund"); diff --git a/src/Orb/Models/CreditNoteTiny.cs b/src/Orb/Models/CreditNoteTiny.cs index ce9be9bd..5b91d017 100644 --- a/src/Orb/Models/CreditNoteTiny.cs +++ b/src/Orb/Models/CreditNoteTiny.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CreditNoteTiny : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CreditNoteTiny : ModelBase, IFromRaw { /// /// The id of the Credit note @@ -17,13 +16,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -34,16 +33,14 @@ public override void Validate() public CreditNoteTiny() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditNoteTiny(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditNoteTiny(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CreditNoteTiny FromRawUnchecked( - Generic::Dictionary properties - ) + public static CreditNoteTiny FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNotes/CreditNoteCreateParams.cs b/src/Orb/Models/CreditNotes/CreditNoteCreateParams.cs index 168903e7..bc29a2a1 100644 --- a/src/Orb/Models/CreditNotes/CreditNoteCreateParams.cs +++ b/src/Orb/Models/CreditNotes/CreditNoteCreateParams.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using CreditNoteCreateParamsProperties = Orb.Models.CreditNotes.CreditNoteCreateParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; namespace Orb.Models.CreditNotes; @@ -35,25 +34,22 @@ namespace Orb.Models.CreditNotes; /// both the start date and end date completely (from start of start_date to end /// of end_date). /// -public sealed record class CreditNoteCreateParams : Orb::ParamsBase +public sealed record class CreditNoteCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; - public required Generic::List LineItems + public required List LineItems { get { - if (!this.BodyProperties.TryGetValue("line_items", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "line_items", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("line_items", out JsonElement element)) + throw new ArgumentOutOfRangeException("line_items", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element - ) ?? throw new System::ArgumentNullException("line_items"); + ) ?? throw new ArgumentNullException("line_items"); } - set { this.BodyProperties["line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["line_items"] = JsonSerializer.SerializeToElement(value); } } /// @@ -63,17 +59,13 @@ public sealed record class CreditNoteCreateParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("reason", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "reason", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("reason", out JsonElement element)) + throw new ArgumentOutOfRangeException("reason", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("reason"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("reason"); } - set { this.BodyProperties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -82,16 +74,16 @@ public sealed record class CreditNoteCreateParams : Orb::ParamsBase /// their own individual service periods specified. If not provided, line items /// will use their original invoice line item service periods. This date is inclusive. /// - public System::DateOnly? EndDate + public DateOnly? EndDate { get { - if (!this.BodyProperties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,12 +93,12 @@ public string? Memo { get { - if (!this.BodyProperties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -115,41 +107,41 @@ public string? Memo /// have their own individual service periods specified. If not provided, line items /// will use their original invoice line item service periods. This date is inclusive. /// - public System::DateOnly? StartDate + public DateOnly? StartDate { get { - if (!this.BodyProperties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["start_date"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/credit_notes") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/credit_notes") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/LineItem.cs b/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/LineItem.cs index e49e443a..ccd3d8ec 100644 --- a/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/LineItem.cs +++ b/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/LineItem.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNotes.CreditNoteCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class LineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class LineItem : ModelBase, IFromRaw { /// /// The total amount in the invoice's currency to credit this line item. @@ -17,16 +16,13 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,21 +32,16 @@ public required string InvoiceLineItemID { get { - if (!this.Properties.TryGetValue("invoice_line_item_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoice_line_item_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_line_item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoice_line_item_id"); - } - set - { - this.Properties["invoice_line_item_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_line_item_id"); } + set { this.Properties["invoice_line_item_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,16 +50,16 @@ public required string InvoiceLineItemID /// line item. If not provided, will use the global end_date if available, otherwise /// defaults to the original invoice line item's end date. This date is inclusive. /// - public System::DateOnly? EndDate + public DateOnly? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,16 +68,16 @@ public required string InvoiceLineItemID /// line item. If not provided, will use the global start_date if available, otherwise /// defaults to the original invoice line item's start date. This date is inclusive. /// - public System::DateOnly? StartDate + public DateOnly? StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -100,16 +91,14 @@ public override void Validate() public LineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + LineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static LineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static LineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/Reason.cs b/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/Reason.cs index 9fdce5ad..a3caf78b 100644 --- a/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/Reason.cs +++ b/src/Orb/Models/CreditNotes/CreditNoteCreateParamsProperties/Reason.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.CreditNotes.CreditNoteCreateParamsProperties; /// /// An optional reason for the credit note. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Reason(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Reason(string value) : IEnum { public static readonly Reason Duplicate = new("duplicate"); @@ -35,7 +34,7 @@ public Value Known() => "fraudulent" => Value.Fraudulent, "order_change" => Value.OrderChange, "product_unsatisfactory" => Value.ProductUnsatisfactory, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/CreditNotes/CreditNoteFetchParams.cs b/src/Orb/Models/CreditNotes/CreditNoteFetchParams.cs index 084a40b8..fd1e4ae6 100644 --- a/src/Orb/Models/CreditNotes/CreditNoteFetchParams.cs +++ b/src/Orb/Models/CreditNotes/CreditNoteFetchParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.CreditNotes; @@ -8,13 +7,13 @@ namespace Orb.Models.CreditNotes; /// This endpoint is used to fetch a single [`Credit Note`](/invoicing/credit-notes) /// given an identifier. /// -public sealed record class CreditNoteFetchParams : Orb::ParamsBase +public sealed record class CreditNoteFetchParams : ParamsBase { public required string CreditNoteID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/credit_notes/{0}", this.CreditNoteID) ) @@ -23,12 +22,12 @@ public sealed record class CreditNoteFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/CreditNotes/CreditNoteListPageResponse.cs b/src/Orb/Models/CreditNotes/CreditNoteListPageResponse.cs index 3cabe13c..d535fef0 100644 --- a/src/Orb/Models/CreditNotes/CreditNoteListPageResponse.cs +++ b/src/Orb/Models/CreditNotes/CreditNoteListPageResponse.cs @@ -1,48 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.CreditNotes; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class CreditNoteListPageResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,15 +53,15 @@ public override void Validate() public CreditNoteListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditNoteListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditNoteListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CreditNoteListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/CreditNotes/CreditNoteListParams.cs b/src/Orb/Models/CreditNotes/CreditNoteListParams.cs index 554d98e8..ec5bc734 100644 --- a/src/Orb/Models/CreditNotes/CreditNoteListParams.cs +++ b/src/Orb/Models/CreditNotes/CreditNoteListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.CreditNotes; @@ -10,70 +9,54 @@ namespace Orb.Models.CreditNotes; /// or external_customer_id. The credit notes will be returned in reverse chronological /// order by `creation_time`. /// -public sealed record class CreditNoteListParams : Orb::ParamsBase +public sealed record class CreditNoteListParams : ParamsBase { - public System::DateTime? CreatedAtGt + public DateTime? CreatedAtGt { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtGte + public DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtLt + public DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtLte + public DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -84,12 +67,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -99,28 +82,28 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/credit_notes") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/credit_notes") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/CustomExpiration.cs b/src/Orb/Models/CustomExpiration.cs index 8caeb9b9..66973dcc 100644 --- a/src/Orb/Models/CustomExpiration.cs +++ b/src/Orb/Models/CustomExpiration.cs @@ -1,46 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CustomExpirationProperties = Orb.Models.CustomExpirationProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CustomExpiration : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CustomExpiration : ModelBase, IFromRaw { public required long Duration { get { - if (!this.Properties.TryGetValue("duration", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "duration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration"] = JsonSerializer.SerializeToElement(value); } } public required CustomExpirationProperties::DurationUnit DurationUnit { get { - if (!this.Properties.TryGetValue("duration_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "duration_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("duration_unit"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("duration_unit"); } - set { this.Properties["duration_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -52,16 +50,14 @@ public override void Validate() public CustomExpiration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomExpiration(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomExpiration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CustomExpiration FromRawUnchecked( - Generic::Dictionary properties - ) + public static CustomExpiration FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CustomExpirationProperties/DurationUnit.cs b/src/Orb/Models/CustomExpirationProperties/DurationUnit.cs index b33c3e72..73b6e12b 100644 --- a/src/Orb/Models/CustomExpirationProperties/DurationUnit.cs +++ b/src/Orb/Models/CustomExpirationProperties/DurationUnit.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.CustomExpirationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DurationUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DurationUnit(string value) : IEnum { public static readonly DurationUnit Day = new("day"); @@ -24,7 +23,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/CustomerMinified.cs b/src/Orb/Models/CustomerMinified.cs index 5a196a65..c032f8dd 100644 --- a/src/Orb/Models/CustomerMinified.cs +++ b/src/Orb/Models/CustomerMinified.cs @@ -1,46 +1,40 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CustomerMinified : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CustomerMinified : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalCustomerID { get { - if (!this.Properties.TryGetValue("external_customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_customer_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "external_customer_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -52,16 +46,14 @@ public override void Validate() public CustomerMinified() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomerMinified(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomerMinified(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CustomerMinified FromRawUnchecked( - Generic::Dictionary properties - ) + public static CustomerMinified FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CustomerTaxID.cs b/src/Orb/Models/CustomerTaxID.cs index 4c9d3e69..6583618f 100644 --- a/src/Orb/Models/CustomerTaxID.cs +++ b/src/Orb/Models/CustomerTaxID.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CustomerTaxIDProperties = Orb.Models.CustomerTaxIDProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; @@ -14,152 +13,143 @@ namespace Orb.Models; /// /// ### Supported Tax ID Countries and Types /// -/// | Country | Type | Description -/// | |----------------|--------------|---------------------------------------------| -/// | Andorra | `ad_nrt` | Andorran NRT Number -/// | | Argentina | `ar_cuit` | Argentinian Tax ID Number -/// | | Australia | `au_abn` | Australian Business Number (AU ABN) -/// | | Australia | `au_arn` | Australian Taxation Office Reference -/// Number | | Austria | `eu_vat` | European VAT Number -/// | | Bahrain | `bh_vat` | Bahraini VAT Number -/// | | Belgium | `eu_vat` | European VAT Number -/// | | Bolivia | `bo_tin` | Bolivian Tax ID -/// | | Brazil | `br_cnpj` | Brazilian CNPJ Number -/// | | Brazil | `br_cpf` | Brazilian CPF Number -/// | | Bulgaria | `bg_uic` | Bulgaria Unified -/// Identification Code | | Bulgaria | `eu_vat` | European VAT Number -/// | | Canada | `ca_bn` | Canadian BN -/// | | Canada | `ca_gst_hst` | Canadian GST/HST -/// Number | | Canada | `ca_pst_bc` | Canadian PST Number -/// (British Columbia) | | Canada | `ca_pst_mb` | Canadian PST Number -/// (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number -/// (Saskatchewan) | | Canada | `ca_qst` | Canadian QST Number -/// (Québec) | | Chile | `cl_tin` | Chilean TIN -/// | | China | `cn_tin` | Chinese Tax ID -/// | | Colombia | `co_nit` | Colombian NIT -/// Number | | Costa Rica | `cr_tin` | Costa Rican -/// Tax ID | | Croatia | `eu_vat` | European -/// VAT Number | | Cyprus | `eu_vat` | European -/// VAT Number | | Czech Republic | `eu_vat` | European -/// VAT Number | | Denmark | `eu_vat` | European -/// VAT Number | | Dominican Republic | `do_rcn` | Dominican -/// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian -/// RUC Number | | Egypt | `eg_tin` | Egyptian -/// Tax Identification Number | | El Salvador | `sv_nit` | -/// El Salvadorian NIT Number | | Estonia | `eu_vat` | European -/// VAT Number | | EU | `eu_oss_vat` | European One Stop Shop VAT Number -/// for non-Union scheme | | Finland | `eu_vat` | European VAT Number -/// | | France | `eu_vat` | European VAT Number -/// | | Georgia | `ge_vat` | Georgian VAT -/// | | Germany | `eu_vat` | European -/// VAT Number | | Greece | `eu_vat` | European -/// VAT Number | | Hong Kong | `hk_br` | Hong -/// Kong BR Number | | Hungary | `eu_vat` -/// | European VAT Number | | Hungary | `hu_tin` -/// | Hungary Tax Number (adószám) | | Iceland | -/// `is_vat` | Icelandic VAT | | India -/// | `in_gst` | Indian GST Number | -/// | Indonesia | `id_npwp` | Indonesian NPWP Number -/// | | Ireland | `eu_vat` | European VAT Number -/// | | Israel | `il_vat` | Israel VAT -/// | | Italy | `eu_vat` | European VAT Number -/// | | Japan | `jp_cn` | Japanese Corporate -/// Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered -/// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) -/// | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku -/// Bangō*) | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification -/// Number | | Kenya | `ke_pin` | Kenya Revenue Authority -/// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number -/// | | Liechtenstein | `li_uid` | Liechtensteinian -/// UID Number | | Lithuania | `eu_vat` | European VAT Number -/// | | Luxembourg | `eu_vat` | European VAT Number -/// | | Malaysia | `my_frp` | Malaysian FRP Number -/// | | Malaysia | `my_itn` | Malaysian ITN | | -/// Malaysia | `my_sst` | Malaysian SST Number | | Malta -/// | `eu_vat ` | European VAT Number | | Mexico -/// | `mx_rfc` | Mexican RFC Number | | Netherlands | `eu_vat` -/// | European VAT Number | | New Zealand | `nz_gst` | New -/// Zealand GST Number | | Nigeria | `ng_tin` | Nigerian -/// Tax Identification Number | | Norway | `no_vat` | Norwegian VAT Number -/// | | Norway | `no_voec` | Norwegian VAT on e-commerce Number -/// | | Oman | `om_vat` | Omani VAT Number | | Peru -/// | `pe_ruc` | Peruvian RUC Number | | Philippines -/// | `ph_tin ` | Philippines Tax Identification Number | | Poland | `eu_vat` -/// | European VAT Number | | Portugal | `eu_vat` | European -/// VAT Number | | Romania | `eu_vat` | European VAT Number -/// | | Romania | `ro_tin` | Romanian Tax ID Number -/// | | Russia | `ru_inn` | Russian INN -/// | | Russia | `ru_kpp` | Russian KPP | | -/// Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Serbia -/// | `rs_pib` | Serbian PIB Number | | Singapore | -/// `sg_gst` | Singaporean GST | | Singapore | `sg_uen` -/// | Singaporean UEN | | Slovakia | `eu_vat` -/// | European VAT Number | | Slovenia | `eu_vat` | European -/// VAT Number | | Slovenia | `si_tin` | Slovenia Tax -/// Number (davčna številka) | | South Africa | `za_vat` -/// | South African VAT Number | | South Korea -/// | `kr_brn` | Korean BRN | | Spain -/// | `es_cif` | Spanish NIF Number (previously Spanish CIF Number) | -/// | Spain | `eu_vat` | European VAT Number -/// | | Sweden | `eu_vat` | European VAT Number -/// | | Switzerland | `ch_vat` | Switzerland VAT -/// Number | | Taiwan | `tw_vat` | Taiwanese -/// VAT | | Thailand | `th_vat` -/// | Thai VAT | | Turkey -/// | `tr_tin` | Turkish Tax Identification Number | | Ukraine -/// | `ua_vat` | Ukrainian VAT | | -/// United Arab Emirates | `ae_trn` | United Arab Emirates TRN -/// | | United Kingdom | `eu_vat` | Northern Ireland VAT Number -/// | | United Kingdom | `gb_vat` | United Kingdom VAT -/// Number | | United States | `us_ein` | United -/// States EIN | | Uruguay | `uy_ruc` -/// | Uruguayan RUC Number | | Venezuela -/// | `ve_rif` | Venezuelan RIF Number | | Vietnam -/// | `vn_tin` | Vietnamese Tax ID Number | +/// | Country | Type | Description | |---------|------|-------------| | Albania | +/// `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran +/// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina +/// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax Identification +/// Number | | Aruba | `aw_tin` | Aruba Tax Identification Number | | Australia | +/// `au_abn` | Australian Business Number (AU ABN) | | Australia | `au_arn` | Australian +/// Taxation Office Reference Number | | Austria | `eu_vat` | European VAT Number +/// | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification Number | | Bahamas | +/// `bs_tin` | Bahamas Tax Identification Number | | Bahrain | `bh_vat` | Bahraini +/// VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business Identification Number +/// | | Barbados | `bb_tin` | Barbados Tax Identification Number | | Belarus | `by_tin` +/// | Belarus TIN Number | | Belgium | `eu_vat` | European VAT Number | | Benin | +/// `bj_ifu` | Benin Tax Identification Number (Identifiant Fiscal Unique) | | Bolivia +/// | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina | `ba_tin` | Bosnia and +/// Herzegovina Tax Identification Number | | Brazil | `br_cnpj` | Brazilian CNPJ +/// Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria | `bg_uic` | +/// Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | European VAT Number +/// | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification Number (Numéro d'Identifiant +/// Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia Tax Identification Number | +/// | Cameroon | `cm_niu` | Cameroon Tax Identification Number (Numéro d'Identifiant +/// fiscal Unique) | | Canada | `ca_bn` | Canadian BN | | Canada | `ca_gst_hst` | +/// Canadian GST/HST Number | | Canada | `ca_pst_bc` | Canadian PST Number (British +/// Columbia) | | Canada | `ca_pst_mb` | Canadian PST Number (Manitoba) | | Canada +/// | `ca_pst_sk` | Canadian PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian +/// QST Number (Québec) | | Cape Verde | `cv_nif` | Cape Verde Tax Identification +/// Number (Número de Identificação Fiscal) | | Chile | `cl_tin` | Chilean TIN | | +/// China | `cn_tin` | Chinese Tax ID | | Colombia | `co_nit` | Colombian NIT Number +/// | | Congo-Kinshasa | `cd_nif` | Congo (DR) Tax Identification Number (Número +/// de Identificação Fiscal) | | Costa Rica | `cr_tin` | Costa Rican Tax ID | | Croatia +/// | `eu_vat` | European VAT Number | | Croatia | `hr_oib` | Croatian Personal Identification +/// Number (OIB) | | Cyprus | `eu_vat` | European VAT Number | | Czech Republic | +/// `eu_vat` | European VAT Number | | Denmark | `eu_vat` | European VAT Number | +/// | Dominican Republic | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` +/// | Ecuadorian RUC Number | | Egypt | `eg_tin` | Egyptian Tax Identification Number +/// | | El Salvador | `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` +/// | European VAT Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number +/// | | European Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union +/// scheme | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European +/// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German +/// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | Greece +/// | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification +/// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong BR +/// Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` | Hungary +/// Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India | `in_gst` +/// | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP Number | | Ireland +/// | `eu_vat` | European VAT Number | | Israel | `il_vat` | Israel VAT | | Italy +/// | `eu_vat` | European VAT Number | | Japan | `jp_cn` | Japanese Corporate Number +/// (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' +/// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | Japan | `jp_trn` +/// | Japanese Tax Registration Number (*Tōroku Bangō*) | | Kazakhstan | `kz_bin` +/// | Kazakhstani Business Identification Number | | Kenya | `ke_pin` | Kenya Revenue +/// Authority Personal Identification Number | | Kyrgyzstan | `kg_tin` | Kyrgyzstan +/// Tax Identification Number | | Laos | `la_tin` | Laos Tax Identification Number +/// | | Latvia | `eu_vat` | European VAT Number | | Liechtenstein | `li_uid` | Liechtensteinian +/// UID Number | | Liechtenstein | `li_vat` | Liechtenstein VAT Number | | Lithuania +/// | `eu_vat` | European VAT Number | | Luxembourg | `eu_vat` | European VAT Number +/// | | Malaysia | `my_frp` | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian +/// ITN | | Malaysia | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European +/// VAT Number | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número +/// de Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova +/// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB Number +/// | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal PAN +/// Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand | `nz_gst` +/// | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification +/// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern +/// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian +/// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman +/// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | Philippines +/// | `ph_tin` | Philippines Tax Identification Number | | Poland | `eu_vat` | European +/// VAT Number | | Portugal | `eu_vat` | European VAT Number | | Romania | `eu_vat` +/// | European VAT Number | | Romania | `ro_tin` | Romanian Tax ID Number | | Russia +/// | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian KPP | | Saudi Arabia +/// | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` | Senegal NINEA Number +/// | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore | `sg_gst` | Singaporean +/// GST | | Singapore | `sg_uen` | Singaporean UEN | | Slovakia | `eu_vat` | European +/// VAT Number | | Slovenia | `eu_vat` | European VAT Number | | Slovenia | `si_tin` +/// | Slovenia Tax Number (davčna številka) | | South Africa | `za_vat` | South African +/// VAT Number | | South Korea | `kr_brn` | Korean BRN | | Spain | `es_cif` | Spanish +/// NIF Number (previously Spanish CIF Number) | | Spain | `eu_vat` | European VAT +/// Number | | Suriname | `sr_fin` | Suriname FIN Number | | Sweden | `eu_vat` | +/// European VAT Number | | Switzerland | `ch_uid` | Switzerland UID Number | | Switzerland +/// | `ch_vat` | Switzerland VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | +/// Tajikistan | `tj_tin` | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` +/// | Tanzania VAT Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` +/// | Turkish Tax Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification +/// Number | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` +/// | United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT +/// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` +/// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | | Uzbekistan +/// | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | Venezuelan RIF +/// Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | Zambia | `zm_tin` +/// | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` | Zimbabwe Tax Identification +/// Number | /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CustomerTaxID : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CustomerTaxID : ModelBase, IFromRaw { public required CustomerTaxIDProperties::Country Country { get { - if (!this.Properties.TryGetValue("country", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("country", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "country", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("country"); } - set { this.Properties["country"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["country"] = JsonSerializer.SerializeToElement(value); } } public required CustomerTaxIDProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public required string Value { get { - if (!this.Properties.TryGetValue("value", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("value", out JsonElement element)) throw new System::ArgumentOutOfRangeException("value", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("value"); } - set { this.Properties["value"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["value"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -172,16 +162,14 @@ public override void Validate() public CustomerTaxID() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomerTaxID(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomerTaxID(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CustomerTaxID FromRawUnchecked( - Generic::Dictionary properties - ) + public static CustomerTaxID FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/CustomerTaxIDProperties/Country.cs b/src/Orb/Models/CustomerTaxIDProperties/Country.cs index 49c6cac3..ad101d62 100644 --- a/src/Orb/Models/CustomerTaxIDProperties/Country.cs +++ b/src/Orb/Models/CustomerTaxIDProperties/Country.cs @@ -1,62 +1,93 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.CustomerTaxIDProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Country(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Country(string value) : IEnum { public static readonly Country Ad = new("AD"); public static readonly Country Ae = new("AE"); + public static readonly Country Al = new("AL"); + + public static readonly Country Am = new("AM"); + + public static readonly Country Ao = new("AO"); + public static readonly Country Ar = new("AR"); public static readonly Country At = new("AT"); public static readonly Country Au = new("AU"); + public static readonly Country Aw = new("AW"); + + public static readonly Country Az = new("AZ"); + + public static readonly Country Ba = new("BA"); + + public static readonly Country Bb = new("BB"); + + public static readonly Country Bd = new("BD"); + public static readonly Country Be = new("BE"); + public static readonly Country Bf = new("BF"); + public static readonly Country Bg = new("BG"); public static readonly Country Bh = new("BH"); + public static readonly Country Bj = new("BJ"); + public static readonly Country Bo = new("BO"); public static readonly Country Br = new("BR"); + public static readonly Country Bs = new("BS"); + + public static readonly Country By = new("BY"); + public static readonly Country Ca = new("CA"); + public static readonly Country Cd = new("CD"); + public static readonly Country Ch = new("CH"); public static readonly Country Cl = new("CL"); + public static readonly Country Cm = new("CM"); + public static readonly Country Cn = new("CN"); public static readonly Country Co = new("CO"); public static readonly Country Cr = new("CR"); + public static readonly Country Cv = new("CV"); + + public static readonly Country De = new("DE"); + public static readonly Country Cy = new("CY"); public static readonly Country Cz = new("CZ"); - public static readonly Country De = new("DE"); - public static readonly Country Dk = new("DK"); - public static readonly Country Ee = new("EE"); - public static readonly Country Do = new("DO"); public static readonly Country Ec = new("EC"); + public static readonly Country Ee = new("EE"); + public static readonly Country Eg = new("EG"); public static readonly Country Es = new("ES"); + public static readonly Country Et = new("ET"); + public static readonly Country Eu = new("EU"); public static readonly Country Fi = new("FI"); @@ -67,6 +98,8 @@ public sealed record class Country(string value) : Orb::IEnum public static readonly Country Ge = new("GE"); + public static readonly Country Gn = new("GN"); + public static readonly Country Gr = new("GR"); public static readonly Country Hk = new("HK"); @@ -91,10 +124,16 @@ public sealed record class Country(string value) : Orb::IEnum public static readonly Country Ke = new("KE"); + public static readonly Country Kg = new("KG"); + + public static readonly Country Kh = new("KH"); + public static readonly Country Kr = new("KR"); public static readonly Country Kz = new("KZ"); + public static readonly Country La = new("LA"); + public static readonly Country Li = new("LI"); public static readonly Country Lt = new("LT"); @@ -103,6 +142,16 @@ public sealed record class Country(string value) : Orb::IEnum public static readonly Country Lv = new("LV"); + public static readonly Country Ma = new("MA"); + + public static readonly Country Md = new("MD"); + + public static readonly Country Me = new("ME"); + + public static readonly Country Mk = new("MK"); + + public static readonly Country Mr = new("MR"); + public static readonly Country Mt = new("MT"); public static readonly Country Mx = new("MX"); @@ -115,6 +164,8 @@ public sealed record class Country(string value) : Orb::IEnum public static readonly Country No = new("NO"); + public static readonly Country Np = new("NP"); + public static readonly Country Nz = new("NZ"); public static readonly Country Om = new("OM"); @@ -143,60 +194,93 @@ public sealed record class Country(string value) : Orb::IEnum public static readonly Country Sk = new("SK"); + public static readonly Country Sn = new("SN"); + + public static readonly Country Sr = new("SR"); + public static readonly Country Sv = new("SV"); public static readonly Country Th = new("TH"); + public static readonly Country Tj = new("TJ"); + public static readonly Country Tr = new("TR"); public static readonly Country Tw = new("TW"); + public static readonly Country Tz = new("TZ"); + public static readonly Country Ua = new("UA"); + public static readonly Country Ug = new("UG"); + public static readonly Country Us = new("US"); public static readonly Country Uy = new("UY"); + public static readonly Country Uz = new("UZ"); + public static readonly Country Ve = new("VE"); public static readonly Country Vn = new("VN"); public static readonly Country Za = new("ZA"); + public static readonly Country Zm = new("ZM"); + + public static readonly Country Zw = new("ZW"); + readonly string _value = value; public enum Value { Ad, Ae, + Al, + Am, + Ao, Ar, At, Au, + Aw, + Az, + Ba, + Bb, + Bd, Be, + Bf, Bg, Bh, + Bj, Bo, Br, + Bs, + By, Ca, + Cd, Ch, Cl, + Cm, Cn, Co, Cr, + Cv, + De, Cy, Cz, - De, Dk, - Ee, Do, Ec, + Ee, Eg, Es, + Et, Eu, Fi, Fr, GB, Ge, + Gn, Gr, Hk, Hr, @@ -209,18 +293,27 @@ public enum Value It, Jp, Ke, + Kg, + Kh, Kr, Kz, + La, Li, Lt, Lu, Lv, + Ma, + Md, + Me, + Mk, + Mr, Mt, Mx, My, Ng, Nl, No, + Np, Nz, Om, Pe, @@ -235,16 +328,24 @@ public enum Value Sg, Si, Sk, + Sn, + Sr, Sv, Th, + Tj, Tr, Tw, + Tz, Ua, + Ug, Us, Uy, + Uz, Ve, Vn, Za, + Zm, + Zw, } public Value Known() => @@ -252,34 +353,51 @@ public Value Known() => { "AD" => Value.Ad, "AE" => Value.Ae, + "AL" => Value.Al, + "AM" => Value.Am, + "AO" => Value.Ao, "AR" => Value.Ar, "AT" => Value.At, "AU" => Value.Au, + "AW" => Value.Aw, + "AZ" => Value.Az, + "BA" => Value.Ba, + "BB" => Value.Bb, + "BD" => Value.Bd, "BE" => Value.Be, + "BF" => Value.Bf, "BG" => Value.Bg, "BH" => Value.Bh, + "BJ" => Value.Bj, "BO" => Value.Bo, "BR" => Value.Br, + "BS" => Value.Bs, + "BY" => Value.By, "CA" => Value.Ca, + "CD" => Value.Cd, "CH" => Value.Ch, "CL" => Value.Cl, + "CM" => Value.Cm, "CN" => Value.Cn, "CO" => Value.Co, "CR" => Value.Cr, + "CV" => Value.Cv, + "DE" => Value.De, "CY" => Value.Cy, "CZ" => Value.Cz, - "DE" => Value.De, "DK" => Value.Dk, - "EE" => Value.Ee, "DO" => Value.Do, "EC" => Value.Ec, + "EE" => Value.Ee, "EG" => Value.Eg, "ES" => Value.Es, + "ET" => Value.Et, "EU" => Value.Eu, "FI" => Value.Fi, "FR" => Value.Fr, "GB" => Value.GB, "GE" => Value.Ge, + "GN" => Value.Gn, "GR" => Value.Gr, "HK" => Value.Hk, "HR" => Value.Hr, @@ -292,18 +410,27 @@ public Value Known() => "IT" => Value.It, "JP" => Value.Jp, "KE" => Value.Ke, + "KG" => Value.Kg, + "KH" => Value.Kh, "KR" => Value.Kr, "KZ" => Value.Kz, + "LA" => Value.La, "LI" => Value.Li, "LT" => Value.Lt, "LU" => Value.Lu, "LV" => Value.Lv, + "MA" => Value.Ma, + "MD" => Value.Md, + "ME" => Value.Me, + "MK" => Value.Mk, + "MR" => Value.Mr, "MT" => Value.Mt, "MX" => Value.Mx, "MY" => Value.My, "NG" => Value.Ng, "NL" => Value.Nl, "NO" => Value.No, + "NP" => Value.Np, "NZ" => Value.Nz, "OM" => Value.Om, "PE" => Value.Pe, @@ -318,16 +445,24 @@ public Value Known() => "SG" => Value.Sg, "SI" => Value.Si, "SK" => Value.Sk, + "SN" => Value.Sn, + "SR" => Value.Sr, "SV" => Value.Sv, "TH" => Value.Th, + "TJ" => Value.Tj, "TR" => Value.Tr, "TW" => Value.Tw, + "TZ" => Value.Tz, "UA" => Value.Ua, + "UG" => Value.Ug, "US" => Value.Us, "UY" => Value.Uy, + "UZ" => Value.Uz, "VE" => Value.Ve, "VN" => Value.Vn, "ZA" => Value.Za, + "ZM" => Value.Zm, + "ZW" => Value.Zw, _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), }; diff --git a/src/Orb/Models/CustomerTaxIDProperties/Type.cs b/src/Orb/Models/CustomerTaxIDProperties/Type.cs index 661d989d..489609f9 100644 --- a/src/Orb/Models/CustomerTaxIDProperties/Type.cs +++ b/src/Orb/Models/CustomerTaxIDProperties/Type.cs @@ -1,16 +1,21 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.CustomerTaxIDProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type AdNrt = new("ad_nrt"); public static readonly Type AeTrn = new("ae_trn"); + public static readonly Type AlTin = new("al_tin"); + + public static readonly Type AmTin = new("am_tin"); + + public static readonly Type AoTin = new("ao_tin"); + public static readonly Type ArCuit = new("ar_cuit"); public static readonly Type EuVat = new("eu_vat"); @@ -19,16 +24,34 @@ public sealed record class Type(string value) : Orb::IEnum public static readonly Type AuArn = new("au_arn"); + public static readonly Type AwTin = new("aw_tin"); + + public static readonly Type AzTin = new("az_tin"); + + public static readonly Type BaTin = new("ba_tin"); + + public static readonly Type BbTin = new("bb_tin"); + + public static readonly Type BdBin = new("bd_bin"); + + public static readonly Type BfIfu = new("bf_ifu"); + public static readonly Type BgUic = new("bg_uic"); public static readonly Type BhVat = new("bh_vat"); + public static readonly Type BjIfu = new("bj_ifu"); + public static readonly Type BoTin = new("bo_tin"); public static readonly Type BrCnpj = new("br_cnpj"); public static readonly Type BrCpf = new("br_cpf"); + public static readonly Type BsTin = new("bs_tin"); + + public static readonly Type ByTin = new("by_tin"); + public static readonly Type CaBn = new("ca_bn"); public static readonly Type CaGstHst = new("ca_gst_hst"); @@ -41,16 +64,26 @@ public sealed record class Type(string value) : Orb::IEnum public static readonly Type CaQst = new("ca_qst"); + public static readonly Type CdNif = new("cd_nif"); + + public static readonly Type ChUid = new("ch_uid"); + public static readonly Type ChVat = new("ch_vat"); public static readonly Type ClTin = new("cl_tin"); + public static readonly Type CmNiu = new("cm_niu"); + public static readonly Type CnTin = new("cn_tin"); public static readonly Type CoNit = new("co_nit"); public static readonly Type CrTin = new("cr_tin"); + public static readonly Type CvNif = new("cv_nif"); + + public static readonly Type DeStn = new("de_stn"); + public static readonly Type DoRcn = new("do_rcn"); public static readonly Type EcRuc = new("ec_ruc"); @@ -59,14 +92,20 @@ public sealed record class Type(string value) : Orb::IEnum public static readonly Type EsCif = new("es_cif"); + public static readonly Type EtTin = new("et_tin"); + public static readonly Type EuOssVat = new("eu_oss_vat"); public static readonly Type GBVat = new("gb_vat"); public static readonly Type GeVat = new("ge_vat"); + public static readonly Type GnNif = new("gn_nif"); + public static readonly Type HkBr = new("hk_br"); + public static readonly Type HrOib = new("hr_oib"); + public static readonly Type HuTin = new("hu_tin"); public static readonly Type IDNpwp = new("id_npwp"); @@ -85,12 +124,30 @@ public sealed record class Type(string value) : Orb::IEnum public static readonly Type KePin = new("ke_pin"); + public static readonly Type KgTin = new("kg_tin"); + + public static readonly Type KhTin = new("kh_tin"); + public static readonly Type KrBrn = new("kr_brn"); public static readonly Type KzBin = new("kz_bin"); + public static readonly Type LaTin = new("la_tin"); + public static readonly Type LiUid = new("li_uid"); + public static readonly Type LiVat = new("li_vat"); + + public static readonly Type MaVat = new("ma_vat"); + + public static readonly Type MdVat = new("md_vat"); + + public static readonly Type MePib = new("me_pib"); + + public static readonly Type MkVat = new("mk_vat"); + + public static readonly Type MrNif = new("mr_nif"); + public static readonly Type MxRfc = new("mx_rfc"); public static readonly Type MyFrp = new("my_frp"); @@ -105,6 +162,8 @@ public sealed record class Type(string value) : Orb::IEnum public static readonly Type NoVoec = new("no_voec"); + public static readonly Type NpPan = new("np_pan"); + public static readonly Type NzGst = new("nz_gst"); public static readonly Type OmVat = new("om_vat"); @@ -129,60 +188,98 @@ public sealed record class Type(string value) : Orb::IEnum public static readonly Type SiTin = new("si_tin"); + public static readonly Type SnNinea = new("sn_ninea"); + + public static readonly Type SrFin = new("sr_fin"); + public static readonly Type SvNit = new("sv_nit"); public static readonly Type ThVat = new("th_vat"); + public static readonly Type TjTin = new("tj_tin"); + public static readonly Type TrTin = new("tr_tin"); public static readonly Type TwVat = new("tw_vat"); + public static readonly Type TzVat = new("tz_vat"); + public static readonly Type UaVat = new("ua_vat"); + public static readonly Type UgTin = new("ug_tin"); + public static readonly Type UsEin = new("us_ein"); public static readonly Type UyRuc = new("uy_ruc"); + public static readonly Type UzTin = new("uz_tin"); + + public static readonly Type UzVat = new("uz_vat"); + public static readonly Type VeRif = new("ve_rif"); public static readonly Type VnTin = new("vn_tin"); public static readonly Type ZaVat = new("za_vat"); + public static readonly Type ZmTin = new("zm_tin"); + + public static readonly Type ZwTin = new("zw_tin"); + readonly string _value = value; public enum Value { AdNrt, AeTrn, + AlTin, + AmTin, + AoTin, ArCuit, EuVat, AuAbn, AuArn, + AwTin, + AzTin, + BaTin, + BbTin, + BdBin, + BfIfu, BgUic, BhVat, + BjIfu, BoTin, BrCnpj, BrCpf, + BsTin, + ByTin, CaBn, CaGstHst, CaPstBc, CaPstMB, CaPstSk, CaQst, + CdNif, + ChUid, ChVat, ClTin, + CmNiu, CnTin, CoNit, CrTin, + CvNif, + DeStn, DoRcn, EcRuc, EgTin, EsCif, + EtTin, EuOssVat, GBVat, GeVat, + GnNif, HkBr, + HrOib, HuTin, IDNpwp, IlVat, @@ -192,9 +289,18 @@ public enum Value JpRn, JpTrn, KePin, + KgTin, + KhTin, KrBrn, KzBin, + LaTin, LiUid, + LiVat, + MaVat, + MdVat, + MePib, + MkVat, + MrNif, MxRfc, MyFrp, MyItn, @@ -202,6 +308,7 @@ public enum Value NgTin, NoVat, NoVoec, + NpPan, NzGst, OmVat, PeRuc, @@ -214,16 +321,25 @@ public enum Value SgGst, SgUen, SiTin, + SnNinea, + SrFin, SvNit, ThVat, + TjTin, TrTin, TwVat, + TzVat, UaVat, + UgTin, UsEin, UyRuc, + UzTin, + UzVat, VeRif, VnTin, ZaVat, + ZmTin, + ZwTin, } public Value Known() => @@ -231,34 +347,54 @@ public Value Known() => { "ad_nrt" => Value.AdNrt, "ae_trn" => Value.AeTrn, + "al_tin" => Value.AlTin, + "am_tin" => Value.AmTin, + "ao_tin" => Value.AoTin, "ar_cuit" => Value.ArCuit, "eu_vat" => Value.EuVat, "au_abn" => Value.AuAbn, "au_arn" => Value.AuArn, + "aw_tin" => Value.AwTin, + "az_tin" => Value.AzTin, + "ba_tin" => Value.BaTin, + "bb_tin" => Value.BbTin, + "bd_bin" => Value.BdBin, + "bf_ifu" => Value.BfIfu, "bg_uic" => Value.BgUic, "bh_vat" => Value.BhVat, + "bj_ifu" => Value.BjIfu, "bo_tin" => Value.BoTin, "br_cnpj" => Value.BrCnpj, "br_cpf" => Value.BrCpf, + "bs_tin" => Value.BsTin, + "by_tin" => Value.ByTin, "ca_bn" => Value.CaBn, "ca_gst_hst" => Value.CaGstHst, "ca_pst_bc" => Value.CaPstBc, "ca_pst_mb" => Value.CaPstMB, "ca_pst_sk" => Value.CaPstSk, "ca_qst" => Value.CaQst, + "cd_nif" => Value.CdNif, + "ch_uid" => Value.ChUid, "ch_vat" => Value.ChVat, "cl_tin" => Value.ClTin, + "cm_niu" => Value.CmNiu, "cn_tin" => Value.CnTin, "co_nit" => Value.CoNit, "cr_tin" => Value.CrTin, + "cv_nif" => Value.CvNif, + "de_stn" => Value.DeStn, "do_rcn" => Value.DoRcn, "ec_ruc" => Value.EcRuc, "eg_tin" => Value.EgTin, "es_cif" => Value.EsCif, + "et_tin" => Value.EtTin, "eu_oss_vat" => Value.EuOssVat, "gb_vat" => Value.GBVat, "ge_vat" => Value.GeVat, + "gn_nif" => Value.GnNif, "hk_br" => Value.HkBr, + "hr_oib" => Value.HrOib, "hu_tin" => Value.HuTin, "id_npwp" => Value.IDNpwp, "il_vat" => Value.IlVat, @@ -268,9 +404,18 @@ public Value Known() => "jp_rn" => Value.JpRn, "jp_trn" => Value.JpTrn, "ke_pin" => Value.KePin, + "kg_tin" => Value.KgTin, + "kh_tin" => Value.KhTin, "kr_brn" => Value.KrBrn, "kz_bin" => Value.KzBin, + "la_tin" => Value.LaTin, "li_uid" => Value.LiUid, + "li_vat" => Value.LiVat, + "ma_vat" => Value.MaVat, + "md_vat" => Value.MdVat, + "me_pib" => Value.MePib, + "mk_vat" => Value.MkVat, + "mr_nif" => Value.MrNif, "mx_rfc" => Value.MxRfc, "my_frp" => Value.MyFrp, "my_itn" => Value.MyItn, @@ -278,6 +423,7 @@ public Value Known() => "ng_tin" => Value.NgTin, "no_vat" => Value.NoVat, "no_voec" => Value.NoVoec, + "np_pan" => Value.NpPan, "nz_gst" => Value.NzGst, "om_vat" => Value.OmVat, "pe_ruc" => Value.PeRuc, @@ -290,16 +436,25 @@ public Value Known() => "sg_gst" => Value.SgGst, "sg_uen" => Value.SgUen, "si_tin" => Value.SiTin, + "sn_ninea" => Value.SnNinea, + "sr_fin" => Value.SrFin, "sv_nit" => Value.SvNit, "th_vat" => Value.ThVat, + "tj_tin" => Value.TjTin, "tr_tin" => Value.TrTin, "tw_vat" => Value.TwVat, + "tz_vat" => Value.TzVat, "ua_vat" => Value.UaVat, + "ug_tin" => Value.UgTin, "us_ein" => Value.UsEin, "uy_ruc" => Value.UyRuc, + "uz_tin" => Value.UzTin, + "uz_vat" => Value.UzVat, "ve_rif" => Value.VeRif, "vn_tin" => Value.VnTin, "za_vat" => Value.ZaVat, + "zm_tin" => Value.ZmTin, + "zw_tin" => Value.ZwTin, _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), }; diff --git a/src/Orb/Models/Customers/AccountingProviderConfig.cs b/src/Orb/Models/Customers/AccountingProviderConfig.cs index 91028111..5439d737 100644 --- a/src/Orb/Models/Customers/AccountingProviderConfig.cs +++ b/src/Orb/Models/Customers/AccountingProviderConfig.cs @@ -1,52 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AccountingProviderConfig - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AccountingProviderConfig : ModelBase, IFromRaw { public required string ExternalProviderID { get { - if (!this.Properties.TryGetValue("external_provider_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_provider_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "external_provider_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("external_provider_id"); } - set - { - this.Properties["external_provider_id"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["external_provider_id"] = JsonSerializer.SerializeToElement(value); } } public required string ProviderType { get { - if (!this.Properties.TryGetValue("provider_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("provider_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "provider_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("provider_type"); } - set { this.Properties["provider_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["provider_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -58,15 +50,15 @@ public override void Validate() public AccountingProviderConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AccountingProviderConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + AccountingProviderConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static AccountingProviderConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/AddressInput.cs b/src/Orb/Models/Customers/AddressInput.cs index f74e5af9..ae98fc02 100644 --- a/src/Orb/Models/Customers/AddressInput.cs +++ b/src/Orb/Models/Customers/AddressInput.cs @@ -1,84 +1,83 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddressInput : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddressInput : ModelBase, IFromRaw { public string? City { get { - if (!this.Properties.TryGetValue("city", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("city", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["city"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["city"] = JsonSerializer.SerializeToElement(value); } } public string? Country { get { - if (!this.Properties.TryGetValue("country", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("country", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["country"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["country"] = JsonSerializer.SerializeToElement(value); } } public string? Line1 { get { - if (!this.Properties.TryGetValue("line1", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line1", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["line1"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line1"] = JsonSerializer.SerializeToElement(value); } } public string? Line2 { get { - if (!this.Properties.TryGetValue("line2", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line2", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["line2"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line2"] = JsonSerializer.SerializeToElement(value); } } public string? PostalCode { get { - if (!this.Properties.TryGetValue("postal_code", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("postal_code", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["postal_code"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["postal_code"] = JsonSerializer.SerializeToElement(value); } } public string? State { get { - if (!this.Properties.TryGetValue("state", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("state", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["state"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["state"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -94,16 +93,14 @@ public override void Validate() public AddressInput() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddressInput(Generic::Dictionary properties) + [SetsRequiredMembers] + AddressInput(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddressInput FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddressInput FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParams.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParams.cs index 27f2dd23..26987ebc 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParams.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParams.cs @@ -1,10 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using BalanceTransactionCreateParamsProperties = Orb.Models.Customers.BalanceTransactions.BalanceTransactionCreateParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Customers.BalanceTransactions; @@ -12,9 +11,9 @@ namespace Orb.Models.Customers.BalanceTransactions; /// Creates an immutable balance transaction that updates the customer's balance and /// returns back the newly created transaction. /// -public sealed record class BalanceTransactionCreateParams : Orb::ParamsBase +public sealed record class BalanceTransactionCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string CustomerID; @@ -22,30 +21,30 @@ public required string Amount { get { - if (!this.BodyProperties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.BodyProperties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["amount"] = JsonSerializer.SerializeToElement(value); } } public required BalanceTransactionCreateParamsProperties::Type Type { get { - if (!this.BodyProperties.TryGetValue("type", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("type"); } - set { this.BodyProperties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -55,15 +54,15 @@ public string? Description { get { - if (!this.BodyProperties.TryGetValue("description", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["description"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -74,21 +73,21 @@ public string? Description }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParamsProperties/Type.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParamsProperties/Type.cs index 5c16e2b7..2d9c1b20 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParamsProperties/Type.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateParamsProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions.BalanceTransactionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Increment = new("increment"); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponse.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponse.cs index a22c76d6..20880036 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponse.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponse.cs @@ -1,18 +1,16 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BalanceTransactionCreateResponseProperties = Orb.Models.Customers.BalanceTransactions.BalanceTransactionCreateResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class BalanceTransactionCreateResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// A unique id for this transaction. @@ -21,30 +19,30 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required BalanceTransactionCreateResponseProperties::Action Action { get { - if (!this.Properties.TryGetValue("action", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("action", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "action", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("action"); } - set { this.Properties["action"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["action"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,16 +52,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,30 +71,30 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CreditNoteTiny? CreditNote + public required CreditNoteTiny? CreditNote { get { - if (!this.Properties.TryGetValue("credit_note", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["credit_note"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_note"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,15 +104,15 @@ public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,31 +122,31 @@ public required string EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("ending_balance"); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } - public required Models::InvoiceTiny? Invoice + public required InvoiceTiny? Invoice { get { - if (!this.Properties.TryGetValue("invoice", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,33 +157,30 @@ public required string StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("starting_balance"); } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public required BalanceTransactionCreateResponseProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -205,15 +200,15 @@ public override void Validate() public BalanceTransactionCreateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BalanceTransactionCreateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BalanceTransactionCreateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BalanceTransactionCreateResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Action.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Action.cs index 7be92ea2..205c51e4 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Action.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Action.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions.BalanceTransactionCreateResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Action(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Action(string value) : IEnum { public static readonly Action AppliedToInvoice = new("applied_to_invoice"); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Type.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Type.cs index 4d6d9d4d..9bae2c7f 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Type.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionCreateResponseProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions.BalanceTransactionCreateResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Increment = new("increment"); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponse.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponse.cs index 02d11c72..6aa21964 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponse.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponse.cs @@ -1,50 +1,46 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BalanceTransactionListPageResponseProperties = Orb.Models.Customers.BalanceTransactions.BalanceTransactionListPageResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class BalanceTransactionListPageResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +55,15 @@ public override void Validate() public BalanceTransactionListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BalanceTransactionListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BalanceTransactionListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BalanceTransactionListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/Data.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/Data.cs index 33caeeed..e7380e57 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/Data.cs @@ -1,16 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Customers.BalanceTransactions.BalanceTransactionListPageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions.BalanceTransactionListPageResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { /// /// A unique id for this transaction. @@ -19,29 +17,29 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::Action Action { get { - if (!this.Properties.TryGetValue("action", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("action", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "action", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("action"); } - set { this.Properties["action"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["action"] = JsonSerializer.SerializeToElement(value); } } /// @@ -51,16 +49,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -70,30 +68,30 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CreditNoteTiny? CreditNote + public required CreditNoteTiny? CreditNote { get { - if (!this.Properties.TryGetValue("credit_note", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["credit_note"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_note"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,15 +101,15 @@ public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,31 +119,31 @@ public required string EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("ending_balance"); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } - public required Models::InvoiceTiny? Invoice + public required InvoiceTiny? Invoice { get { - if (!this.Properties.TryGetValue("invoice", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,32 +154,29 @@ public required string StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("starting_balance"); } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -201,14 +196,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Action.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Action.cs index 6442f1cc..6cad7ff7 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Action.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Action.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions.BalanceTransactionListPageResponseProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Action(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Action(string value) : IEnum { public static readonly Action AppliedToInvoice = new("applied_to_invoice"); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Type.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Type.cs index 375f5d8b..103d09bc 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Type.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListPageResponseProperties/DataProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.BalanceTransactions.BalanceTransactionListPageResponseProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Increment = new("increment"); diff --git a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListParams.cs b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListParams.cs index 00854cf7..0371e8bf 100644 --- a/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListParams.cs +++ b/src/Orb/Models/Customers/BalanceTransactions/BalanceTransactionListParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Customers.BalanceTransactions; @@ -27,7 +26,7 @@ namespace Orb.Models.Customers.BalanceTransactions; /// order for a single customer, providing a complete audit trail of all adjustments /// and invoice applications. /// -public sealed record class BalanceTransactionListParams : Orb::ParamsBase +public sealed record class BalanceTransactionListParams : ParamsBase { public required string CustomerID; @@ -39,12 +38,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,33 +53,26 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? OperationTimeGt { get { - if ( - !this.QueryProperties.TryGetValue( - "operation_time[gt]", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("operation_time[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["operation_time[gt]"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["operation_time[gt]"] = JsonSerializer.SerializeToElement(value); } } @@ -88,21 +80,14 @@ public long? Limit { get { - if ( - !this.QueryProperties.TryGetValue( - "operation_time[gte]", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("operation_time[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["operation_time[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["operation_time[gte]"] = JsonSerializer.SerializeToElement(value); } } @@ -110,21 +95,14 @@ public long? Limit { get { - if ( - !this.QueryProperties.TryGetValue( - "operation_time[lt]", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("operation_time[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["operation_time[lt]"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["operation_time[lt]"] = JsonSerializer.SerializeToElement(value); } } @@ -132,25 +110,18 @@ public long? Limit { get { - if ( - !this.QueryProperties.TryGetValue( - "operation_time[lte]", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("operation_time[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["operation_time[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["operation_time[lte]"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -161,12 +132,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Costs/CostListByExternalIDParams.cs b/src/Orb/Models/Customers/Costs/CostListByExternalIDParams.cs index 9f24c587..e6571eb8 100644 --- a/src/Orb/Models/Customers/Costs/CostListByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Costs/CostListByExternalIDParams.cs @@ -1,8 +1,7 @@ +using System; +using System.Net.Http; +using System.Text.Json; using CostListByExternalIDParamsProperties = Orb.Models.Customers.Costs.CostListByExternalIDParamsProperties; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; namespace Orb.Models.Customers.Costs; @@ -102,7 +101,7 @@ namespace Orb.Models.Customers.Costs; /// and `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` /// and `secondary_grouping_value` available. /// -public sealed record class CostListByExternalIDParams : Orb::ParamsBase +public sealed record class CostListByExternalIDParams : ParamsBase { public required string ExternalCustomerID; @@ -113,50 +112,42 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// Costs returned are exclusive of `timeframe_end`. /// - public System::DateTime? TimeframeEnd + public DateTime? TimeframeEnd { get { - if (!this.QueryProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_end", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// /// Costs returned are inclusive of `timeframe_start`. /// - public System::DateTime? TimeframeStart + public DateTime? TimeframeStart { get { - if (!this.QueryProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_start", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -168,19 +159,19 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("view_mode", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("view_mode", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set { this.QueryProperties["view_mode"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["view_mode"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/customers/external_customer_id/{0}/costs", @@ -192,12 +183,12 @@ public string? Currency }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Costs/CostListByExternalIDParamsProperties/ViewMode.cs b/src/Orb/Models/Customers/Costs/CostListByExternalIDParamsProperties/ViewMode.cs index 6c946f90..5534296c 100644 --- a/src/Orb/Models/Customers/Costs/CostListByExternalIDParamsProperties/ViewMode.cs +++ b/src/Orb/Models/Customers/Costs/CostListByExternalIDParamsProperties/ViewMode.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Costs.CostListByExternalIDParamsProperties; @@ -9,8 +8,8 @@ namespace Orb.Models.Customers.Costs.CostListByExternalIDParamsProperties; /// or incremental day-by-day costs. If your customer has minimums or discounts, it's /// strongly recommended that you use the default cumulative behavior. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ViewMode(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ViewMode(string value) : IEnum { public static readonly ViewMode Periodic = new("periodic"); @@ -29,7 +28,7 @@ public Value Known() => { "periodic" => Value.Periodic, "cumulative" => Value.Cumulative, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Costs/CostListByExternalIDResponse.cs b/src/Orb/Models/Customers/Costs/CostListByExternalIDResponse.cs index 1063ef50..349025ee 100644 --- a/src/Orb/Models/Customers/Costs/CostListByExternalIDResponse.cs +++ b/src/Orb/Models/Customers/Costs/CostListByExternalIDResponse.cs @@ -1,29 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Costs; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class CostListByExternalIDResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,15 +35,15 @@ public override void Validate() public CostListByExternalIDResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CostListByExternalIDResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CostListByExternalIDResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CostListByExternalIDResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Costs/CostListParams.cs b/src/Orb/Models/Customers/Costs/CostListParams.cs index 34e1dbda..2b983abf 100644 --- a/src/Orb/Models/Customers/Costs/CostListParams.cs +++ b/src/Orb/Models/Customers/Costs/CostListParams.cs @@ -1,8 +1,7 @@ +using System; +using System.Net.Http; +using System.Text.Json; using CostListParamsProperties = Orb.Models.Customers.Costs.CostListParamsProperties; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; namespace Orb.Models.Customers.Costs; @@ -102,7 +101,7 @@ namespace Orb.Models.Customers.Costs; /// and `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` /// and `secondary_grouping_value` available. /// -public sealed record class CostListParams : Orb::ParamsBase +public sealed record class CostListParams : ParamsBase { public required string CustomerID; @@ -113,50 +112,42 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// Costs returned are exclusive of `timeframe_end`. /// - public System::DateTime? TimeframeEnd + public DateTime? TimeframeEnd { get { - if (!this.QueryProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_end", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// /// Costs returned are inclusive of `timeframe_start`. /// - public System::DateTime? TimeframeStart + public DateTime? TimeframeStart { get { - if (!this.QueryProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_start", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -168,17 +159,17 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("view_mode", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("view_mode", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["view_mode"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["view_mode"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/customers/{0}/costs", this.CustomerID) ) @@ -187,12 +178,12 @@ public string? Currency }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Costs/CostListParamsProperties/ViewMode.cs b/src/Orb/Models/Customers/Costs/CostListParamsProperties/ViewMode.cs index 19d6f1b6..9aea5304 100644 --- a/src/Orb/Models/Customers/Costs/CostListParamsProperties/ViewMode.cs +++ b/src/Orb/Models/Customers/Costs/CostListParamsProperties/ViewMode.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Costs.CostListParamsProperties; @@ -9,8 +8,8 @@ namespace Orb.Models.Customers.Costs.CostListParamsProperties; /// or incremental day-by-day costs. If your customer has minimums or discounts, it's /// strongly recommended that you use the default cumulative behavior. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ViewMode(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ViewMode(string value) : IEnum { public static readonly ViewMode Periodic = new("periodic"); @@ -29,7 +28,7 @@ public Value Known() => { "periodic" => Value.Periodic, "cumulative" => Value.Cumulative, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Costs/CostListResponse.cs b/src/Orb/Models/Customers/Costs/CostListResponse.cs index 3f41c245..c08f3737 100644 --- a/src/Orb/Models/Customers/Costs/CostListResponse.cs +++ b/src/Orb/Models/Customers/Costs/CostListResponse.cs @@ -1,27 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Costs; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CostListResponse : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CostListResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -35,16 +33,14 @@ public override void Validate() public CostListResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CostListResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CostListResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CostListResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static CostListResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponse.cs b/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponse.cs index 584b3cf4..b555ec0e 100644 --- a/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponse.cs +++ b/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponse.cs @@ -1,50 +1,46 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CreditListByExternalIDPageResponseProperties = Orb.Models.Customers.Credits.CreditListByExternalIDPageResponseProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class CreditListByExternalIDPageResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +55,15 @@ public override void Validate() public CreditListByExternalIDPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditListByExternalIDPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditListByExternalIDPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CreditListByExternalIDPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/Data.cs b/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/Data.cs index 4c8ef5ac..aeb2581f 100644 --- a/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/Data.cs @@ -1,96 +1,82 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Customers.Credits.CreditListByExternalIDPageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Customers.Credits.CreditListByExternalIDPageResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Balance { get { - if (!this.Properties.TryGetValue("balance", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "balance", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("balance", out JsonElement element)) + throw new ArgumentOutOfRangeException("balance", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["balance"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime? EffectiveDate + public required DateTime? EffectiveDate { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) + throw new ArgumentOutOfRangeException( "effective_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime? ExpiryDate + public required DateTime? ExpiryDate { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "expiry_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("expiry_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } public required double? MaximumInitialBalance { get { - if ( - !this.Properties.TryGetValue( - "maximum_initial_balance", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_initial_balance", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_initial_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["maximum_initial_balance"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["maximum_initial_balance"] = JsonSerializer.SerializeToElement(value); } } @@ -98,34 +84,28 @@ public required string? PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -142,14 +122,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/DataProperties/Status.cs b/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/DataProperties/Status.cs index 8b58cee3..076cfb42 100644 --- a/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/DataProperties/Status.cs +++ b/src/Orb/Models/Customers/Credits/CreditListByExternalIDPageResponseProperties/DataProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.CreditListByExternalIDPageResponseProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -24,7 +23,7 @@ public Value Known() => { "active" => Value.Active, "pending_payment" => Value.PendingPayment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/CreditListByExternalIDParams.cs b/src/Orb/Models/Customers/Credits/CreditListByExternalIDParams.cs index f6d31581..fa31b56b 100644 --- a/src/Orb/Models/Customers/Credits/CreditListByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Credits/CreditListByExternalIDParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Customers.Credits; @@ -14,7 +13,7 @@ namespace Orb.Models.Customers.Credits; /// Note that `currency` defaults to credits if not specified. To use a real world /// currency, set `currency` to an ISO 4217 string. /// -public sealed record class CreditListByExternalIDParams : Orb::ParamsBase +public sealed record class CreditListByExternalIDParams : ParamsBase { public required string ExternalCustomerID; @@ -25,12 +24,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,12 +40,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,21 +56,14 @@ public bool? IncludeAllBlocks { get { - if ( - !this.QueryProperties.TryGetValue( - "include_all_blocks", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("include_all_blocks", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["include_all_blocks"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["include_all_blocks"] = JsonSerializer.SerializeToElement(value); } } @@ -82,15 +74,15 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -104,12 +96,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/CreditListPageResponse.cs b/src/Orb/Models/Customers/Credits/CreditListPageResponse.cs index 95f724fc..1fc38616 100644 --- a/src/Orb/Models/Customers/Credits/CreditListPageResponse.cs +++ b/src/Orb/Models/Customers/Credits/CreditListPageResponse.cs @@ -1,50 +1,43 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CreditListPageResponseProperties = Orb.Models.Customers.Credits.CreditListPageResponseProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CreditListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CreditListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +52,15 @@ public override void Validate() public CreditListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CreditListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/Data.cs b/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/Data.cs index 8095e71c..9e3aee21 100644 --- a/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/Data.cs @@ -1,96 +1,82 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Customers.Credits.CreditListPageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Customers.Credits.CreditListPageResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Balance { get { - if (!this.Properties.TryGetValue("balance", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "balance", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("balance", out JsonElement element)) + throw new ArgumentOutOfRangeException("balance", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["balance"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime? EffectiveDate + public required DateTime? EffectiveDate { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) + throw new ArgumentOutOfRangeException( "effective_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime? ExpiryDate + public required DateTime? ExpiryDate { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "expiry_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("expiry_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } public required double? MaximumInitialBalance { get { - if ( - !this.Properties.TryGetValue( - "maximum_initial_balance", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_initial_balance", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_initial_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["maximum_initial_balance"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["maximum_initial_balance"] = JsonSerializer.SerializeToElement(value); } } @@ -98,34 +84,28 @@ public required string? PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -142,14 +122,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/DataProperties/Status.cs b/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/DataProperties/Status.cs index 68febc3f..6a1ede1c 100644 --- a/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/DataProperties/Status.cs +++ b/src/Orb/Models/Customers/Credits/CreditListPageResponseProperties/DataProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.CreditListPageResponseProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -24,7 +23,7 @@ public Value Known() => { "active" => Value.Active, "pending_payment" => Value.PendingPayment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/CreditListParams.cs b/src/Orb/Models/Customers/Credits/CreditListParams.cs index d05eb537..1a188f9e 100644 --- a/src/Orb/Models/Customers/Credits/CreditListParams.cs +++ b/src/Orb/Models/Customers/Credits/CreditListParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Customers.Credits; @@ -14,7 +13,7 @@ namespace Orb.Models.Customers.Credits; /// Note that `currency` defaults to credits if not specified. To use a real world /// currency, set `currency` to an ISO 4217 string. /// -public sealed record class CreditListParams : Orb::ParamsBase +public sealed record class CreditListParams : ParamsBase { public required string CustomerID; @@ -25,12 +24,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,12 +40,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,21 +56,14 @@ public bool? IncludeAllBlocks { get { - if ( - !this.QueryProperties.TryGetValue( - "include_all_blocks", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("include_all_blocks", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["include_all_blocks"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["include_all_blocks"] = JsonSerializer.SerializeToElement(value); } } @@ -82,15 +74,15 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -101,12 +93,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/Ledger/AffectedBlock.cs b/src/Orb/Models/Customers/Credits/Ledger/AffectedBlock.cs index 516a36ca..77ed2b48 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/AffectedBlock.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/AffectedBlock.cs @@ -1,59 +1,55 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AffectedBlock : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AffectedBlock : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime? ExpiryDate { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "expiry_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } public required string? PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -66,16 +62,14 @@ public override void Validate() public AffectedBlock() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AffectedBlock(Generic::Dictionary properties) + [SetsRequiredMembers] + AffectedBlock(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AffectedBlock FromRawUnchecked( - Generic::Dictionary properties - ) + public static AffectedBlock FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntry.cs index 58bcd11e..3dbde778 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntry.cs @@ -1,196 +1,183 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AmendmentLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.AmendmentLedgerEntryProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AmendmentLedgerEntry - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AmendmentLedgerEntry : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required AmendmentLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("entry_status"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required AmendmentLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -200,38 +187,35 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -257,16 +241,14 @@ public override void Validate() public AmendmentLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AmendmentLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + AmendmentLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AmendmentLedgerEntry FromRawUnchecked( - Generic::Dictionary properties - ) + public static AmendmentLedgerEntry FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryStatus.cs index 5a763918..999b2cb7 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.AmendmentLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryType.cs index aafe392a..8b91173c 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/AmendmentLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.AmendmentLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType Amendment = new("amendment"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "amendment" => Value.Amendment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntry.cs index c039b745..d4ae891a 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntry.cs @@ -1,196 +1,187 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CreditBlockExpiryLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.CreditBlockExpiryLedgerEntryProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class CreditBlockExpiryLedgerEntry - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required CreditBlockExpiryLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required CreditBlockExpiryLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -200,38 +191,35 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -257,15 +245,15 @@ public override void Validate() public CreditBlockExpiryLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditBlockExpiryLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditBlockExpiryLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CreditBlockExpiryLedgerEntry FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryStatus.cs index 2e48df70..8745e353 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.CreditBlockExpiryLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryType.cs index 0f8bf6f4..9525e620 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/CreditBlockExpiryLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.CreditBlockExpiryLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType CreditBlockExpiry = new("credit_block_expiry"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "credit_block_expiry" => Value.CreditBlockExpiry, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntry.cs index c5064574..a9f4de06 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntry.cs @@ -1,196 +1,183 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DecrementLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.DecrementLedgerEntryProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class DecrementLedgerEntry - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class DecrementLedgerEntry : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required DecrementLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("entry_status"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required DecrementLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -200,74 +187,71 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public string? EventID { get { - if (!this.Properties.TryGetValue("event_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("event_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["event_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["event_id"] = JsonSerializer.SerializeToElement(value); } } public string? InvoiceID { get { - if (!this.Properties.TryGetValue("invoice_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_id"] = JsonSerializer.SerializeToElement(value); } } public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -296,16 +280,14 @@ public override void Validate() public DecrementLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - DecrementLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + DecrementLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static DecrementLedgerEntry FromRawUnchecked( - Generic::Dictionary properties - ) + public static DecrementLedgerEntry FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryStatus.cs index 95fe3c5d..6028f441 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.DecrementLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryType.cs index a19ec349..4f989d17 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/DecrementLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.DecrementLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType Decrement = new("decrement"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "decrement" => Value.Decrement, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntry.cs index 2dab1c53..17013459 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntry.cs @@ -1,196 +1,187 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ExpirationChangeLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.ExpirationChangeLedgerEntryProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class ExpirationChangeLedgerEntry - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required ExpirationChangeLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required ExpirationChangeLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -200,60 +191,50 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime? NewBlockExpiryDate { get { - if ( - !this.Properties.TryGetValue("new_block_expiry_date", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("new_block_expiry_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "new_block_expiry_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["new_block_expiry_date"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["new_block_expiry_date"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -280,15 +261,15 @@ public override void Validate() public ExpirationChangeLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ExpirationChangeLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + ExpirationChangeLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ExpirationChangeLedgerEntry FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryStatus.cs index 524ae48b..1604af18 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.ExpirationChangeLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryType.cs index 5cc6ea30..68bfa176 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/ExpirationChangeLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.ExpirationChangeLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType ExpirationChange = new("expiration_change"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "expiration_change" => Value.ExpirationChange, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntry.cs index 49b20a20..a427318d 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntry.cs @@ -1,196 +1,183 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using IncrementLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.IncrementLedgerEntryProperties; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class IncrementLedgerEntry - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class IncrementLedgerEntry : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required IncrementLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("entry_status"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required IncrementLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -200,56 +187,50 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } /// /// If the increment resulted in invoice creation, the list of created invoices /// - public Generic::List? CreatedInvoices + public List? CreatedInvoices { get { - if (!this.Properties.TryGetValue("created_invoices", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_invoices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["created_invoices"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["created_invoices"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -279,16 +260,14 @@ public override void Validate() public IncrementLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - IncrementLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + IncrementLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static IncrementLedgerEntry FromRawUnchecked( - Generic::Dictionary properties - ) + public static IncrementLedgerEntry FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryStatus.cs index baa37a1d..a5de4c42 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.IncrementLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryType.cs index e1e83663..a65c4554 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/IncrementLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.IncrementLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType Increment = new("increment"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "increment" => Value.Increment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParams.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParams.cs index a99dfe9a..5b9ae545 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using LedgerCreateEntryByExternalIDParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Customers.Credits.Ledger; @@ -89,9 +88,9 @@ namespace Orb.Models.Customers.Credits.Ledger; /// that was originally decremented from, and `amount` indicates how many credits /// to return to the customer, up to the block's initial balance. /// -public sealed record class LedgerCreateEntryByExternalIDParams : Orb::ParamsBase +public sealed record class LedgerCreateEntryByExternalIDParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ExternalCustomerID; @@ -99,17 +98,17 @@ public sealed record class LedgerCreateEntryByExternalIDParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("body", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("body", out JsonElement element)) throw new System::ArgumentOutOfRangeException("body", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("body"); } - set { this.BodyProperties["body"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["body"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -123,21 +122,21 @@ public sealed record class LedgerCreateEntryByExternalIDParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/Body.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/Body.cs index 0b3c3e4d..a2032570 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/Body.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/Body.cs @@ -1,25 +1,28 @@ +using System.Text.Json.Serialization; using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; using BodyVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Body { internal Body() { } - public static BodyVariants::Increment Create(BodyProperties::Increment value) => new(value); + public static implicit operator Body(BodyProperties::Increment value) => + new BodyVariants::Increment(value); - public static BodyVariants::Decrement Create(BodyProperties::Decrement value) => new(value); + public static implicit operator Body(BodyProperties::Decrement value) => + new BodyVariants::Decrement(value); - public static BodyVariants::ExpirationChange Create(BodyProperties::ExpirationChange value) => - new(value); + public static implicit operator Body(BodyProperties::ExpirationChange value) => + new BodyVariants::ExpirationChange(value); - public static BodyVariants::Void Create(BodyProperties::Void value) => new(value); + public static implicit operator Body(BodyProperties::Void value) => + new BodyVariants::Void(value); - public static BodyVariants::Amendment Create(BodyProperties::Amendment value) => new(value); + public static implicit operator Body(BodyProperties::Amendment value) => + new BodyVariants::Amendment(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Amendment.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Amendment.cs index bf8f4f58..6855b78d 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Amendment.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Amendment.cs @@ -1,15 +1,13 @@ -using AmendmentProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.AmendmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Amendment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Amendment : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,15 +17,15 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,32 +35,31 @@ public required string BlockID { get { - if (!this.Properties.TryGetValue("block_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("block_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "block_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("block_id"); } - set { this.Properties["block_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["block_id"] = JsonSerializer.SerializeToElement(value); } } - public required AmendmentProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,12 +70,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +87,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,23 +100,22 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; _ = this.BlockID; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; if (this.Metadata != null) @@ -131,19 +127,20 @@ public override void Validate() } } - public Amendment() { } + public Amendment() + { + this.EntryType = JsonSerializer.Deserialize("\"amendment\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Amendment(Generic::Dictionary properties) + [SetsRequiredMembers] + Amendment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Amendment FromRawUnchecked( - Generic::Dictionary properties - ) + public static Amendment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/AmendmentProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/AmendmentProperties/EntryType.cs deleted file mode 100644 index 5d718f37..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/AmendmentProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.AmendmentProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Amendment = new("amendment"); - - readonly string _value = value; - - public enum Value - { - Amendment, - } - - public Value Known() => - _value switch - { - "amendment" => Value.Amendment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Decrement.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Decrement.cs index bc513951..5f87f161 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Decrement.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Decrement.cs @@ -1,15 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using DecrementProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.DecrementProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Decrement : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Decrement : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,31 +17,30 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } - public required DecrementProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +51,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,12 +68,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -84,22 +81,21 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; if (this.Metadata != null) @@ -111,19 +107,20 @@ public override void Validate() } } - public Decrement() { } + public Decrement() + { + this.EntryType = JsonSerializer.Deserialize("\"decrement\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Decrement(Generic::Dictionary properties) + [SetsRequiredMembers] + Decrement(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Decrement FromRawUnchecked( - Generic::Dictionary properties - ) + public static Decrement FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/DecrementProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/DecrementProperties/EntryType.cs deleted file mode 100644 index 83266bfb..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/DecrementProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.DecrementProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Decrement = new("decrement"); - - readonly string _value = value; - - public enum Value - { - Decrement, - } - - public Value Known() => - _value switch - { - "decrement" => Value.Decrement, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChange.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChange.cs index 29355e60..7819a70b 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChange.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChange.cs @@ -1,30 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using ExpirationChangeProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.ExpirationChangeProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ExpirationChange : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ExpirationChange : ModelBase, IFromRaw { - public required ExpirationChangeProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,18 +32,15 @@ public sealed record class ExpirationChange : Orb::ModelBase, Orb::IFromRaw(element); - } - set - { - this.Properties["target_expiry_date"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["target_expiry_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,12 +51,12 @@ public double? Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,12 +67,12 @@ public string? BlockID { get { - if (!this.Properties.TryGetValue("block_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("block_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["block_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["block_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -89,12 +83,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,12 +100,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,12 +115,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -134,21 +128,20 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { - this.EntryType.Validate(); _ = this.TargetExpiryDate; _ = this.Amount; _ = this.BlockID; @@ -164,19 +157,20 @@ public override void Validate() } } - public ExpirationChange() { } + public ExpirationChange() + { + this.EntryType = JsonSerializer.Deserialize("\"expiration_change\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ExpirationChange(Generic::Dictionary properties) + [SetsRequiredMembers] + ExpirationChange(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ExpirationChange FromRawUnchecked( - Generic::Dictionary properties - ) + public static ExpirationChange FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChangeProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChangeProperties/EntryType.cs deleted file mode 100644 index 7c0399c7..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/ExpirationChangeProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.ExpirationChangeProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType ExpirationChange = new("expiration_change"); - - readonly string _value = value; - - public enum Value - { - ExpirationChange, - } - - public Value Known() => - _value switch - { - "expiration_change" => Value.ExpirationChange, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Increment.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Increment.cs index c759cc5e..ff271a6b 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Increment.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Increment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using IncrementProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Increment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Increment : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,31 +18,30 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } - public required IncrementProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +52,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,12 +69,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -87,12 +85,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,12 +100,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,15 +117,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("invoice_settings", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_settings", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_settings"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,16 +130,16 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,21 +150,17 @@ public string? PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; _ = this.EffectiveDate; @@ -185,19 +176,20 @@ public override void Validate() _ = this.PerUnitCostBasis; } - public Increment() { } + public Increment() + { + this.EntryType = JsonSerializer.Deserialize("\"increment\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Increment(Generic::Dictionary properties) + [SetsRequiredMembers] + Increment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Increment FromRawUnchecked( - Generic::Dictionary properties - ) + public static Increment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/EntryType.cs deleted file mode 100644 index 7f047af8..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Increment = new("increment"); - - readonly string _value = value; - - public enum Value - { - Increment, - } - - public Value Known() => - _value switch - { - "increment" => Value.Increment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs index a5ca5439..0764043d 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using InvoiceSettingsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties; @@ -13,8 +12,8 @@ namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParam /// credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, /// as the calculation of the invoice total is done on that basis. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class InvoiceSettings : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class InvoiceSettings : ModelBase, IFromRaw { /// /// Whether the credits purchase invoice should auto collect with the customer's @@ -24,15 +23,15 @@ public required bool AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,19 +39,19 @@ public required bool AutoCollection /// date for the invoice. If you intend the invoice to be due on issue, set this /// to 0. /// - public required long NetTerms + public required long? NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "net_terms", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -64,14 +63,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("invoice_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -81,12 +78,12 @@ public string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -97,19 +94,14 @@ public bool? RequireSuccessfulPayment { get { - if ( - !this.Properties.TryGetValue( - "require_successful_payment", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("require_successful_payment", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["require_successful_payment"] = Json::JsonSerializer.SerializeToElement( + this.Properties["require_successful_payment"] = JsonSerializer.SerializeToElement( value ); } @@ -127,16 +119,14 @@ public override void Validate() public InvoiceSettings() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceSettings(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceSettings(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static InvoiceSettings FromRawUnchecked( - Generic::Dictionary properties - ) + public static InvoiceSettings FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs index 23b18551..d39d5edc 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs @@ -1,6 +1,5 @@ +using System.Text.Json.Serialization; using InvoiceDateVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties.InvoiceDateVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; @@ -10,14 +9,16 @@ namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParam /// customer's timezone. If not provided, the invoice date will default to the credit /// block's effective date. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class InvoiceDate { internal InvoiceDate() { } - public static InvoiceDateVariants::Date Create(System::DateOnly value) => new(value); + public static implicit operator InvoiceDate(System::DateOnly value) => + new InvoiceDateVariants::Date(value); - public static InvoiceDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator InvoiceDate(System::DateTime value) => + new InvoiceDateVariants::DateTime(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs index 04405607..8c309fec 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs @@ -1,14 +1,12 @@ -using InvoiceSettingsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties.InvoiceDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Date(System::DateOnly Value) - : InvoiceSettingsProperties::InvoiceDate, - Orb::IVariant + : InvoiceDate, + IVariant { public static Date From(System::DateOnly value) { @@ -18,10 +16,10 @@ public static Date From(System::DateOnly value) public override void Validate() { } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : InvoiceSettingsProperties::InvoiceDate, - Orb::IVariant + : InvoiceDate, + IVariant { public static DateTime From(System::DateTime value) { diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Void.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Void.cs index 6f3d1d36..ad6c21ea 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Void.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/Void.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using VoidProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.VoidProperties; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Void : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Void : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,15 +18,15 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,32 +36,31 @@ public required string BlockID { get { - if (!this.Properties.TryGetValue("block_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("block_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "block_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("block_id"); } - set { this.Properties["block_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["block_id"] = JsonSerializer.SerializeToElement(value); } } - public required VoidProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,12 +71,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +88,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,16 +101,16 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,19 +120,18 @@ public string? Description { get { - if (!this.Properties.TryGetValue("void_reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("void_reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["void_reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["void_reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; _ = this.BlockID; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; if (this.Metadata != null) @@ -147,17 +144,20 @@ public override void Validate() this.VoidReason?.Validate(); } - public Void() { } + public Void() + { + this.EntryType = JsonSerializer.Deserialize("\"void\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Void(Generic::Dictionary properties) + [SetsRequiredMembers] + Void(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Void FromRawUnchecked(Generic::Dictionary properties) + public static Void FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/EntryType.cs deleted file mode 100644 index a2868395..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.VoidProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Void = new("void"); - - readonly string _value = value; - - public enum Value - { - Void, - } - - public Value Known() => - _value switch - { - "void" => Value.Void, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/VoidReason.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/VoidReason.cs index 1a153087..6a6a2b08 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/VoidReason.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyProperties/VoidProperties/VoidReason.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties.VoidProperties; /// /// Can only be specified when `entry_type=void`. The reason for the void. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class VoidReason(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class VoidReason(string value) : IEnum { public static readonly VoidReason Refund = new("refund"); @@ -23,7 +22,7 @@ public Value Known() => _value switch { "refund" => Value.Refund, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyVariants/All.cs index a4732b98..08964a69 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDParamsProperties/BodyVariants/All.cs @@ -1,14 +1,12 @@ +using System.Text.Json.Serialization; using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyProperties; -using LedgerCreateEntryByExternalIDParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDParamsProperties.BodyVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Increment(BodyProperties::Increment Value) - : LedgerCreateEntryByExternalIDParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Increment From(BodyProperties::Increment value) { @@ -21,10 +19,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Decrement(BodyProperties::Decrement Value) - : LedgerCreateEntryByExternalIDParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Decrement From(BodyProperties::Decrement value) { @@ -37,12 +35,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class ExpirationChange(BodyProperties::ExpirationChange Value) - : LedgerCreateEntryByExternalIDParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static ExpirationChange From(BodyProperties::ExpirationChange value) { @@ -55,10 +51,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Void(BodyProperties::Void Value) - : LedgerCreateEntryByExternalIDParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Void From(BodyProperties::Void value) { @@ -71,10 +67,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Amendment(BodyProperties::Amendment Value) - : LedgerCreateEntryByExternalIDParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Amendment From(BodyProperties::Amendment value) { diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponse.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponse.cs index 1e3b2ce9..0d986ceb 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponse.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponse.cs @@ -1,6 +1,5 @@ +using System.Text.Json.Serialization; using LedgerCreateEntryByExternalIDResponseVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDResponseVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger; @@ -8,38 +7,43 @@ namespace Orb.Models.Customers.Credits.Ledger; /// The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid /// credits within Orb. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class LedgerCreateEntryByExternalIDResponse { internal LedgerCreateEntryByExternalIDResponse() { } - public static LedgerCreateEntryByExternalIDResponseVariants::IncrementLedgerEntry Create( + public static implicit operator LedgerCreateEntryByExternalIDResponse( IncrementLedgerEntry value - ) => new(value); + ) => new LedgerCreateEntryByExternalIDResponseVariants::IncrementLedgerEntryVariant(value); - public static LedgerCreateEntryByExternalIDResponseVariants::DecrementLedgerEntry Create( + public static implicit operator LedgerCreateEntryByExternalIDResponse( DecrementLedgerEntry value - ) => new(value); + ) => new LedgerCreateEntryByExternalIDResponseVariants::DecrementLedgerEntryVariant(value); - public static LedgerCreateEntryByExternalIDResponseVariants::ExpirationChangeLedgerEntry Create( + public static implicit operator LedgerCreateEntryByExternalIDResponse( ExpirationChangeLedgerEntry value - ) => new(value); + ) => + new LedgerCreateEntryByExternalIDResponseVariants::ExpirationChangeLedgerEntryVariant( + value + ); - public static LedgerCreateEntryByExternalIDResponseVariants::CreditBlockExpiryLedgerEntry Create( + public static implicit operator LedgerCreateEntryByExternalIDResponse( CreditBlockExpiryLedgerEntry value - ) => new(value); + ) => + new LedgerCreateEntryByExternalIDResponseVariants::CreditBlockExpiryLedgerEntryVariant( + value + ); - public static LedgerCreateEntryByExternalIDResponseVariants::VoidLedgerEntry Create( - VoidLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryByExternalIDResponse(VoidLedgerEntry value) => + new LedgerCreateEntryByExternalIDResponseVariants::VoidLedgerEntryVariant(value); - public static LedgerCreateEntryByExternalIDResponseVariants::VoidInitiatedLedgerEntry Create( + public static implicit operator LedgerCreateEntryByExternalIDResponse( VoidInitiatedLedgerEntry value - ) => new(value); + ) => new LedgerCreateEntryByExternalIDResponseVariants::VoidInitiatedLedgerEntryVariant(value); - public static LedgerCreateEntryByExternalIDResponseVariants::AmendmentLedgerEntry Create( + public static implicit operator LedgerCreateEntryByExternalIDResponse( AmendmentLedgerEntry value - ) => new(value); + ) => new LedgerCreateEntryByExternalIDResponseVariants::AmendmentLedgerEntryVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponseVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponseVariants/All.cs index 978c6a4d..b55ecfa1 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponseVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryByExternalIDResponseVariants/All.cs @@ -1,17 +1,13 @@ -using Ledger = Orb.Models.Customers.Credits.Ledger; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryByExternalIDResponseVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class IncrementLedgerEntry(Ledger::IncrementLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class IncrementLedgerEntryVariant(IncrementLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static IncrementLedgerEntry From(Ledger::IncrementLedgerEntry value) + public static IncrementLedgerEntryVariant From(IncrementLedgerEntry value) { return new(value); } @@ -22,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class DecrementLedgerEntry(Ledger::DecrementLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class DecrementLedgerEntryVariant(DecrementLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static DecrementLedgerEntry From(Ledger::DecrementLedgerEntry value) + public static DecrementLedgerEntryVariant From(DecrementLedgerEntry value) { return new(value); } @@ -40,14 +34,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class ExpirationChangeLedgerEntry(Ledger::ExpirationChangeLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +public sealed record class ExpirationChangeLedgerEntryVariant(ExpirationChangeLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static ExpirationChangeLedgerEntry From(Ledger::ExpirationChangeLedgerEntry value) + public static ExpirationChangeLedgerEntryVariant From(ExpirationChangeLedgerEntry value) { return new(value); } @@ -58,17 +52,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - CreditBlockExpiryLedgerEntry, - Ledger::CreditBlockExpiryLedgerEntry - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class CreditBlockExpiryLedgerEntry(Ledger::CreditBlockExpiryLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +public sealed record class CreditBlockExpiryLedgerEntryVariant(CreditBlockExpiryLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static CreditBlockExpiryLedgerEntry From(Ledger::CreditBlockExpiryLedgerEntry value) + public static CreditBlockExpiryLedgerEntryVariant From(CreditBlockExpiryLedgerEntry value) { return new(value); } @@ -79,14 +70,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidLedgerEntry(Ledger::VoidLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidLedgerEntryVariant(VoidLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static VoidLedgerEntry From(Ledger::VoidLedgerEntry value) + public static VoidLedgerEntryVariant From(VoidLedgerEntry value) { return new(value); } @@ -97,14 +86,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidInitiatedLedgerEntry(Ledger::VoidInitiatedLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidInitiatedLedgerEntryVariant(VoidInitiatedLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static VoidInitiatedLedgerEntry From(Ledger::VoidInitiatedLedgerEntry value) + public static VoidInitiatedLedgerEntryVariant From(VoidInitiatedLedgerEntry value) { return new(value); } @@ -115,14 +102,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmendmentLedgerEntry(Ledger::AmendmentLedgerEntry Value) - : Ledger::LedgerCreateEntryByExternalIDResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmendmentLedgerEntryVariant(AmendmentLedgerEntry Value) + : LedgerCreateEntryByExternalIDResponse, + IVariant { - public static AmendmentLedgerEntry From(Ledger::AmendmentLedgerEntry value) + public static AmendmentLedgerEntryVariant From(AmendmentLedgerEntry value) { return new(value); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParams.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParams.cs index 436683d2..17887335 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParams.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using LedgerCreateEntryParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Customers.Credits.Ledger; @@ -89,9 +88,9 @@ namespace Orb.Models.Customers.Credits.Ledger; /// that was originally decremented from, and `amount` indicates how many credits /// to return to the customer, up to the block's initial balance. /// -public sealed record class LedgerCreateEntryParams : Orb::ParamsBase +public sealed record class LedgerCreateEntryParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string CustomerID; @@ -99,17 +98,16 @@ public sealed record class LedgerCreateEntryParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("body", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("body", out JsonElement element)) throw new System::ArgumentOutOfRangeException("body", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("body"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("body"); } - set { this.BodyProperties["body"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["body"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -120,21 +118,21 @@ public sealed record class LedgerCreateEntryParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/Body.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/Body.cs index cb0e525b..ae413c5d 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/Body.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/Body.cs @@ -1,25 +1,28 @@ +using System.Text.Json.Serialization; using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; using BodyVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Body { internal Body() { } - public static BodyVariants::Increment Create(BodyProperties::Increment value) => new(value); + public static implicit operator Body(BodyProperties::Increment value) => + new BodyVariants::Increment(value); - public static BodyVariants::Decrement Create(BodyProperties::Decrement value) => new(value); + public static implicit operator Body(BodyProperties::Decrement value) => + new BodyVariants::Decrement(value); - public static BodyVariants::ExpirationChange Create(BodyProperties::ExpirationChange value) => - new(value); + public static implicit operator Body(BodyProperties::ExpirationChange value) => + new BodyVariants::ExpirationChange(value); - public static BodyVariants::Void Create(BodyProperties::Void value) => new(value); + public static implicit operator Body(BodyProperties::Void value) => + new BodyVariants::Void(value); - public static BodyVariants::Amendment Create(BodyProperties::Amendment value) => new(value); + public static implicit operator Body(BodyProperties::Amendment value) => + new BodyVariants::Amendment(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Amendment.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Amendment.cs index 2dd02dae..db020a4e 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Amendment.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Amendment.cs @@ -1,15 +1,13 @@ -using AmendmentProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.AmendmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Amendment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Amendment : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,15 +17,15 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,32 +35,31 @@ public required string BlockID { get { - if (!this.Properties.TryGetValue("block_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("block_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "block_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("block_id"); } - set { this.Properties["block_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["block_id"] = JsonSerializer.SerializeToElement(value); } } - public required AmendmentProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,12 +70,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +87,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,23 +100,22 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; _ = this.BlockID; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; if (this.Metadata != null) @@ -131,19 +127,20 @@ public override void Validate() } } - public Amendment() { } + public Amendment() + { + this.EntryType = JsonSerializer.Deserialize("\"amendment\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Amendment(Generic::Dictionary properties) + [SetsRequiredMembers] + Amendment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Amendment FromRawUnchecked( - Generic::Dictionary properties - ) + public static Amendment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/AmendmentProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/AmendmentProperties/EntryType.cs deleted file mode 100644 index 9efb1cbf..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/AmendmentProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.AmendmentProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Amendment = new("amendment"); - - readonly string _value = value; - - public enum Value - { - Amendment, - } - - public Value Known() => - _value switch - { - "amendment" => Value.Amendment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Decrement.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Decrement.cs index 854e870a..7b502423 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Decrement.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Decrement.cs @@ -1,15 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using DecrementProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.DecrementProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Decrement : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Decrement : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,31 +17,30 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } - public required DecrementProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +51,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,12 +68,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -84,22 +81,21 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; if (this.Metadata != null) @@ -111,19 +107,20 @@ public override void Validate() } } - public Decrement() { } + public Decrement() + { + this.EntryType = JsonSerializer.Deserialize("\"decrement\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Decrement(Generic::Dictionary properties) + [SetsRequiredMembers] + Decrement(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Decrement FromRawUnchecked( - Generic::Dictionary properties - ) + public static Decrement FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/DecrementProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/DecrementProperties/EntryType.cs deleted file mode 100644 index a720a3de..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/DecrementProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.DecrementProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Decrement = new("decrement"); - - readonly string _value = value; - - public enum Value - { - Decrement, - } - - public Value Known() => - _value switch - { - "decrement" => Value.Decrement, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChange.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChange.cs index b89e3e03..dc99a79b 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChange.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChange.cs @@ -1,30 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using ExpirationChangeProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.ExpirationChangeProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ExpirationChange : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ExpirationChange : ModelBase, IFromRaw { - public required ExpirationChangeProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,18 +32,15 @@ public sealed record class ExpirationChange : Orb::ModelBase, Orb::IFromRaw(element); - } - set - { - this.Properties["target_expiry_date"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["target_expiry_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,12 +51,12 @@ public double? Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,12 +67,12 @@ public string? BlockID { get { - if (!this.Properties.TryGetValue("block_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("block_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["block_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["block_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -89,12 +83,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,12 +100,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,12 +115,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -134,21 +128,20 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { - this.EntryType.Validate(); _ = this.TargetExpiryDate; _ = this.Amount; _ = this.BlockID; @@ -164,19 +157,20 @@ public override void Validate() } } - public ExpirationChange() { } + public ExpirationChange() + { + this.EntryType = JsonSerializer.Deserialize("\"expiration_change\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ExpirationChange(Generic::Dictionary properties) + [SetsRequiredMembers] + ExpirationChange(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ExpirationChange FromRawUnchecked( - Generic::Dictionary properties - ) + public static ExpirationChange FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChangeProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChangeProperties/EntryType.cs deleted file mode 100644 index 78e2b0a0..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/ExpirationChangeProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.ExpirationChangeProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType ExpirationChange = new("expiration_change"); - - readonly string _value = value; - - public enum Value - { - ExpirationChange, - } - - public Value Known() => - _value switch - { - "expiration_change" => Value.ExpirationChange, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Increment.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Increment.cs index b851597d..804bfca1 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Increment.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Increment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using IncrementProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Increment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Increment : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,31 +18,30 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } - public required IncrementProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +52,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,12 +69,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -87,12 +85,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,12 +100,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("expiry_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expiry_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiry_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiry_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,15 +117,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("invoice_settings", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_settings", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_settings"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,16 +130,16 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,21 +150,17 @@ public string? PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; _ = this.EffectiveDate; @@ -185,19 +176,20 @@ public override void Validate() _ = this.PerUnitCostBasis; } - public Increment() { } + public Increment() + { + this.EntryType = JsonSerializer.Deserialize("\"increment\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Increment(Generic::Dictionary properties) + [SetsRequiredMembers] + Increment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Increment FromRawUnchecked( - Generic::Dictionary properties - ) + public static Increment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/EntryType.cs deleted file mode 100644 index b7a800c7..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Increment = new("increment"); - - readonly string _value = value; - - public enum Value - { - Increment, - } - - public Value Known() => - _value switch - { - "increment" => Value.Increment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs index deca99ce..a9552d66 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettings.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using InvoiceSettingsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties; @@ -13,8 +12,8 @@ namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties. /// credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, /// as the calculation of the invoice total is done on that basis. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class InvoiceSettings : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class InvoiceSettings : ModelBase, IFromRaw { /// /// Whether the credits purchase invoice should auto collect with the customer's @@ -24,15 +23,15 @@ public required bool AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,19 +39,19 @@ public required bool AutoCollection /// date for the invoice. If you intend the invoice to be due on issue, set this /// to 0. /// - public required long NetTerms + public required long? NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "net_terms", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -64,14 +63,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("invoice_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -81,12 +78,12 @@ public string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -97,19 +94,14 @@ public bool? RequireSuccessfulPayment { get { - if ( - !this.Properties.TryGetValue( - "require_successful_payment", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("require_successful_payment", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["require_successful_payment"] = Json::JsonSerializer.SerializeToElement( + this.Properties["require_successful_payment"] = JsonSerializer.SerializeToElement( value ); } @@ -127,16 +119,14 @@ public override void Validate() public InvoiceSettings() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceSettings(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceSettings(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static InvoiceSettings FromRawUnchecked( - Generic::Dictionary properties - ) + public static InvoiceSettings FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs index d9360435..95502310 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDate.cs @@ -1,6 +1,5 @@ +using System.Text.Json.Serialization; using InvoiceDateVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties.InvoiceDateVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; @@ -10,14 +9,16 @@ namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties. /// customer's timezone. If not provided, the invoice date will default to the credit /// block's effective date. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class InvoiceDate { internal InvoiceDate() { } - public static InvoiceDateVariants::Date Create(System::DateOnly value) => new(value); + public static implicit operator InvoiceDate(System::DateOnly value) => + new InvoiceDateVariants::Date(value); - public static InvoiceDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator InvoiceDate(System::DateTime value) => + new InvoiceDateVariants::DateTime(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs index 1949ad83..2607cd9d 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/IncrementProperties/InvoiceSettingsProperties/InvoiceDateVariants/All.cs @@ -1,14 +1,12 @@ -using InvoiceSettingsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.IncrementProperties.InvoiceSettingsProperties.InvoiceDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Date(System::DateOnly Value) - : InvoiceSettingsProperties::InvoiceDate, - Orb::IVariant + : InvoiceDate, + IVariant { public static Date From(System::DateOnly value) { @@ -18,10 +16,10 @@ public static Date From(System::DateOnly value) public override void Validate() { } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : InvoiceSettingsProperties::InvoiceDate, - Orb::IVariant + : InvoiceDate, + IVariant { public static DateTime From(System::DateTime value) { diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Void.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Void.cs index 241e839d..c63d5d30 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Void.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/Void.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using VoidProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.VoidProperties; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Void : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Void : ModelBase, IFromRaw { /// /// The number of credits to effect. Note that this is required for increment, @@ -19,15 +18,15 @@ public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,32 +36,31 @@ public required string BlockID { get { - if (!this.Properties.TryGetValue("block_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("block_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "block_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("block_id"); } - set { this.Properties["block_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["block_id"] = JsonSerializer.SerializeToElement(value); } } - public required VoidProperties::EntryType EntryType + public JsonElement EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("entry_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,12 +71,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +88,12 @@ public string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,16 +101,16 @@ public string? Description /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,19 +120,18 @@ public string? Description { get { - if (!this.Properties.TryGetValue("void_reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("void_reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["void_reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["void_reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.Amount; _ = this.BlockID; - this.EntryType.Validate(); _ = this.Currency; _ = this.Description; if (this.Metadata != null) @@ -147,17 +144,20 @@ public override void Validate() this.VoidReason?.Validate(); } - public Void() { } + public Void() + { + this.EntryType = JsonSerializer.Deserialize("\"void\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Void(Generic::Dictionary properties) + [SetsRequiredMembers] + Void(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Void FromRawUnchecked(Generic::Dictionary properties) + public static Void FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/EntryType.cs deleted file mode 100644 index d1cfb757..00000000 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/EntryType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.VoidProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum -{ - public static readonly EntryType Void = new("void"); - - readonly string _value = value; - - public enum Value - { - Void, - } - - public Value Known() => - _value switch - { - "void" => Value.Void, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static EntryType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/VoidReason.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/VoidReason.cs index 3f90bda4..9ca2dd84 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/VoidReason.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyProperties/VoidProperties/VoidReason.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties.VoidProperties; /// /// Can only be specified when `entry_type=void`. The reason for the void. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class VoidReason(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class VoidReason(string value) : IEnum { public static readonly VoidReason Refund = new("refund"); @@ -23,7 +22,7 @@ public Value Known() => _value switch { "refund" => Value.Refund, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyVariants/All.cs index c4973bb8..6e5ccb2f 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryParamsProperties/BodyVariants/All.cs @@ -1,14 +1,12 @@ +using System.Text.Json.Serialization; using BodyProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyProperties; -using LedgerCreateEntryParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryParamsProperties.BodyVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Increment(BodyProperties::Increment Value) - : LedgerCreateEntryParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Increment From(BodyProperties::Increment value) { @@ -21,10 +19,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Decrement(BodyProperties::Decrement Value) - : LedgerCreateEntryParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Decrement From(BodyProperties::Decrement value) { @@ -37,12 +35,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class ExpirationChange(BodyProperties::ExpirationChange Value) - : LedgerCreateEntryParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static ExpirationChange From(BodyProperties::ExpirationChange value) { @@ -55,10 +51,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Void(BodyProperties::Void Value) - : LedgerCreateEntryParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Void From(BodyProperties::Void value) { @@ -71,10 +67,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Amendment(BodyProperties::Amendment Value) - : LedgerCreateEntryParamsProperties::Body, - Orb::IVariant + : Body, + IVariant { public static Amendment From(BodyProperties::Amendment value) { diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponse.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponse.cs index 85cb64d2..f20afae3 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponse.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponse.cs @@ -1,6 +1,5 @@ +using System.Text.Json.Serialization; using LedgerCreateEntryResponseVariants = Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryResponseVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger; @@ -8,38 +7,31 @@ namespace Orb.Models.Customers.Credits.Ledger; /// The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid /// credits within Orb. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class LedgerCreateEntryResponse { internal LedgerCreateEntryResponse() { } - public static LedgerCreateEntryResponseVariants::IncrementLedgerEntry Create( - IncrementLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(IncrementLedgerEntry value) => + new LedgerCreateEntryResponseVariants::IncrementLedgerEntryVariant(value); - public static LedgerCreateEntryResponseVariants::DecrementLedgerEntry Create( - DecrementLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(DecrementLedgerEntry value) => + new LedgerCreateEntryResponseVariants::DecrementLedgerEntryVariant(value); - public static LedgerCreateEntryResponseVariants::ExpirationChangeLedgerEntry Create( - ExpirationChangeLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(ExpirationChangeLedgerEntry value) => + new LedgerCreateEntryResponseVariants::ExpirationChangeLedgerEntryVariant(value); - public static LedgerCreateEntryResponseVariants::CreditBlockExpiryLedgerEntry Create( - CreditBlockExpiryLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(CreditBlockExpiryLedgerEntry value) => + new LedgerCreateEntryResponseVariants::CreditBlockExpiryLedgerEntryVariant(value); - public static LedgerCreateEntryResponseVariants::VoidLedgerEntry Create( - VoidLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(VoidLedgerEntry value) => + new LedgerCreateEntryResponseVariants::VoidLedgerEntryVariant(value); - public static LedgerCreateEntryResponseVariants::VoidInitiatedLedgerEntry Create( - VoidInitiatedLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(VoidInitiatedLedgerEntry value) => + new LedgerCreateEntryResponseVariants::VoidInitiatedLedgerEntryVariant(value); - public static LedgerCreateEntryResponseVariants::AmendmentLedgerEntry Create( - AmendmentLedgerEntry value - ) => new(value); + public static implicit operator LedgerCreateEntryResponse(AmendmentLedgerEntry value) => + new LedgerCreateEntryResponseVariants::AmendmentLedgerEntryVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponseVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponseVariants/All.cs index 8e0e7ed0..2446a62c 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponseVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerCreateEntryResponseVariants/All.cs @@ -1,17 +1,13 @@ -using Ledger = Orb.Models.Customers.Credits.Ledger; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerCreateEntryResponseVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class IncrementLedgerEntry(Ledger::IncrementLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class IncrementLedgerEntryVariant(IncrementLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static IncrementLedgerEntry From(Ledger::IncrementLedgerEntry value) + public static IncrementLedgerEntryVariant From(IncrementLedgerEntry value) { return new(value); } @@ -22,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class DecrementLedgerEntry(Ledger::DecrementLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class DecrementLedgerEntryVariant(DecrementLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static DecrementLedgerEntry From(Ledger::DecrementLedgerEntry value) + public static DecrementLedgerEntryVariant From(DecrementLedgerEntry value) { return new(value); } @@ -40,14 +34,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class ExpirationChangeLedgerEntry(Ledger::ExpirationChangeLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +public sealed record class ExpirationChangeLedgerEntryVariant(ExpirationChangeLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static ExpirationChangeLedgerEntry From(Ledger::ExpirationChangeLedgerEntry value) + public static ExpirationChangeLedgerEntryVariant From(ExpirationChangeLedgerEntry value) { return new(value); } @@ -58,17 +52,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - CreditBlockExpiryLedgerEntry, - Ledger::CreditBlockExpiryLedgerEntry - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class CreditBlockExpiryLedgerEntry(Ledger::CreditBlockExpiryLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +public sealed record class CreditBlockExpiryLedgerEntryVariant(CreditBlockExpiryLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static CreditBlockExpiryLedgerEntry From(Ledger::CreditBlockExpiryLedgerEntry value) + public static CreditBlockExpiryLedgerEntryVariant From(CreditBlockExpiryLedgerEntry value) { return new(value); } @@ -79,14 +70,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidLedgerEntry(Ledger::VoidLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidLedgerEntryVariant(VoidLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static VoidLedgerEntry From(Ledger::VoidLedgerEntry value) + public static VoidLedgerEntryVariant From(VoidLedgerEntry value) { return new(value); } @@ -97,14 +86,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidInitiatedLedgerEntry(Ledger::VoidInitiatedLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidInitiatedLedgerEntryVariant(VoidInitiatedLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static VoidInitiatedLedgerEntry From(Ledger::VoidInitiatedLedgerEntry value) + public static VoidInitiatedLedgerEntryVariant From(VoidInitiatedLedgerEntry value) { return new(value); } @@ -115,14 +102,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmendmentLedgerEntry(Ledger::AmendmentLedgerEntry Value) - : Ledger::LedgerCreateEntryResponse, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmendmentLedgerEntryVariant(AmendmentLedgerEntry Value) + : LedgerCreateEntryResponse, + IVariant { - public static AmendmentLedgerEntry From(Ledger::AmendmentLedgerEntry value) + public static AmendmentLedgerEntryVariant From(AmendmentLedgerEntry value) { return new(value); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponse.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponse.cs index 69ea462d..87c48d9b 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponse.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponse.cs @@ -1,50 +1,46 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using LedgerListByExternalIDPageResponseProperties = Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDPageResponseProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class LedgerListByExternalIDPageResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +55,15 @@ public override void Validate() public LedgerListByExternalIDPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LedgerListByExternalIDPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + LedgerListByExternalIDPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static LedgerListByExternalIDPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/Data.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/Data.cs index 4409f9a2..c5437b60 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/Data.cs @@ -1,7 +1,5 @@ +using System.Text.Json.Serialization; using DataVariants = Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDPageResponseProperties.DataVariants; -using Ledger = Orb.Models.Customers.Credits.Ledger; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDPageResponseProperties; @@ -9,33 +7,31 @@ namespace Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDPageResponse /// The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid /// credits within Orb. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Data { internal Data() { } - public static DataVariants::IncrementLedgerEntry Create(Ledger::IncrementLedgerEntry value) => - new(value); + public static implicit operator Data(IncrementLedgerEntry value) => + new DataVariants::IncrementLedgerEntryVariant(value); - public static DataVariants::DecrementLedgerEntry Create(Ledger::DecrementLedgerEntry value) => - new(value); + public static implicit operator Data(DecrementLedgerEntry value) => + new DataVariants::DecrementLedgerEntryVariant(value); - public static DataVariants::ExpirationChangeLedgerEntry Create( - Ledger::ExpirationChangeLedgerEntry value - ) => new(value); + public static implicit operator Data(ExpirationChangeLedgerEntry value) => + new DataVariants::ExpirationChangeLedgerEntryVariant(value); - public static DataVariants::CreditBlockExpiryLedgerEntry Create( - Ledger::CreditBlockExpiryLedgerEntry value - ) => new(value); + public static implicit operator Data(CreditBlockExpiryLedgerEntry value) => + new DataVariants::CreditBlockExpiryLedgerEntryVariant(value); - public static DataVariants::VoidLedgerEntry Create(Ledger::VoidLedgerEntry value) => new(value); + public static implicit operator Data(VoidLedgerEntry value) => + new DataVariants::VoidLedgerEntryVariant(value); - public static DataVariants::VoidInitiatedLedgerEntry Create( - Ledger::VoidInitiatedLedgerEntry value - ) => new(value); + public static implicit operator Data(VoidInitiatedLedgerEntry value) => + new DataVariants::VoidInitiatedLedgerEntryVariant(value); - public static DataVariants::AmendmentLedgerEntry Create(Ledger::AmendmentLedgerEntry value) => - new(value); + public static implicit operator Data(AmendmentLedgerEntry value) => + new DataVariants::AmendmentLedgerEntryVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/DataVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/DataVariants/All.cs index f19a33c2..7e6bd9c8 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/DataVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDPageResponseProperties/DataVariants/All.cs @@ -1,18 +1,13 @@ -using Ledger = Orb.Models.Customers.Credits.Ledger; -using LedgerListByExternalIDPageResponseProperties = Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDPageResponseProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDPageResponseProperties.DataVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class IncrementLedgerEntry(Ledger::IncrementLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class IncrementLedgerEntryVariant(IncrementLedgerEntry Value) + : Data, + IVariant { - public static IncrementLedgerEntry From(Ledger::IncrementLedgerEntry value) + public static IncrementLedgerEntryVariant From(IncrementLedgerEntry value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class DecrementLedgerEntry(Ledger::DecrementLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class DecrementLedgerEntryVariant(DecrementLedgerEntry Value) + : Data, + IVariant { - public static DecrementLedgerEntry From(Ledger::DecrementLedgerEntry value) + public static DecrementLedgerEntryVariant From(DecrementLedgerEntry value) { return new(value); } @@ -41,14 +34,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class ExpirationChangeLedgerEntry(Ledger::ExpirationChangeLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +public sealed record class ExpirationChangeLedgerEntryVariant(ExpirationChangeLedgerEntry Value) + : Data, + IVariant { - public static ExpirationChangeLedgerEntry From(Ledger::ExpirationChangeLedgerEntry value) + public static ExpirationChangeLedgerEntryVariant From(ExpirationChangeLedgerEntry value) { return new(value); } @@ -59,17 +52,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - CreditBlockExpiryLedgerEntry, - Ledger::CreditBlockExpiryLedgerEntry - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class CreditBlockExpiryLedgerEntry(Ledger::CreditBlockExpiryLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +public sealed record class CreditBlockExpiryLedgerEntryVariant(CreditBlockExpiryLedgerEntry Value) + : Data, + IVariant { - public static CreditBlockExpiryLedgerEntry From(Ledger::CreditBlockExpiryLedgerEntry value) + public static CreditBlockExpiryLedgerEntryVariant From(CreditBlockExpiryLedgerEntry value) { return new(value); } @@ -80,14 +70,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidLedgerEntry(Ledger::VoidLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidLedgerEntryVariant(VoidLedgerEntry Value) + : Data, + IVariant { - public static VoidLedgerEntry From(Ledger::VoidLedgerEntry value) + public static VoidLedgerEntryVariant From(VoidLedgerEntry value) { return new(value); } @@ -98,14 +86,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidInitiatedLedgerEntry(Ledger::VoidInitiatedLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidInitiatedLedgerEntryVariant(VoidInitiatedLedgerEntry Value) + : Data, + IVariant { - public static VoidInitiatedLedgerEntry From(Ledger::VoidInitiatedLedgerEntry value) + public static VoidInitiatedLedgerEntryVariant From(VoidInitiatedLedgerEntry value) { return new(value); } @@ -116,14 +102,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmendmentLedgerEntry(Ledger::AmendmentLedgerEntry Value) - : LedgerListByExternalIDPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmendmentLedgerEntryVariant(AmendmentLedgerEntry Value) + : Data, + IVariant { - public static AmendmentLedgerEntry From(Ledger::AmendmentLedgerEntry value) + public static AmendmentLedgerEntryVariant From(AmendmentLedgerEntry value) { return new(value); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParams.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParams.cs index 830858ca..acf01848 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; +using System.Net.Http; +using System.Text.Json; using LedgerListByExternalIDParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDParamsProperties; -using Orb = Orb; using System = System; namespace Orb.Models.Customers.Credits.Ledger; @@ -73,7 +72,7 @@ namespace Orb.Models.Customers.Credits.Ledger; /// correction, this entry will be added to the ledger to indicate the adjustment /// of credits. /// -public sealed record class LedgerListByExternalIDParams : Orb::ParamsBase +public sealed record class LedgerListByExternalIDParams : ParamsBase { public required string ExternalCustomerID; @@ -81,64 +80,48 @@ public sealed record class LedgerListByExternalIDParams : Orb::ParamsBase { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -148,12 +131,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -164,43 +147,40 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } public LedgerListByExternalIDParamsProperties::EntryStatus? EntryStatus { get { - if (!this.QueryProperties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("entry_status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.QueryProperties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.QueryProperties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public LedgerListByExternalIDParamsProperties::EntryType? EntryType { get { - if (!this.QueryProperties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("entry_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set { this.QueryProperties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -210,30 +190,27 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } public string? MinimumAmount { get { - if (!this.QueryProperties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -247,12 +224,12 @@ public string? MinimumAmount }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryStatus.cs index 3d41c636..e060bdd9 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryType.cs index 8b56743e..27d5dd71 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListByExternalIDParamsProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListByExternalIDParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType Increment = new("increment"); @@ -44,7 +43,7 @@ public Value Known() => "void" => Value.Void, "void_initiated" => Value.VoidInitiated, "amendment" => Value.Amendment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponse.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponse.cs index 5ab23e58..6d90441f 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponse.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponse.cs @@ -1,50 +1,43 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using LedgerListPageResponseProperties = Orb.Models.Customers.Credits.Ledger.LedgerListPageResponseProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class LedgerListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class LedgerListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +52,15 @@ public override void Validate() public LedgerListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LedgerListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + LedgerListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static LedgerListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/Data.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/Data.cs index 81b04ba8..d6d7a8df 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/Data.cs @@ -1,7 +1,5 @@ +using System.Text.Json.Serialization; using DataVariants = Orb.Models.Customers.Credits.Ledger.LedgerListPageResponseProperties.DataVariants; -using Ledger = Orb.Models.Customers.Credits.Ledger; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListPageResponseProperties; @@ -9,33 +7,31 @@ namespace Orb.Models.Customers.Credits.Ledger.LedgerListPageResponseProperties; /// The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid /// credits within Orb. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Data { internal Data() { } - public static DataVariants::IncrementLedgerEntry Create(Ledger::IncrementLedgerEntry value) => - new(value); + public static implicit operator Data(IncrementLedgerEntry value) => + new DataVariants::IncrementLedgerEntryVariant(value); - public static DataVariants::DecrementLedgerEntry Create(Ledger::DecrementLedgerEntry value) => - new(value); + public static implicit operator Data(DecrementLedgerEntry value) => + new DataVariants::DecrementLedgerEntryVariant(value); - public static DataVariants::ExpirationChangeLedgerEntry Create( - Ledger::ExpirationChangeLedgerEntry value - ) => new(value); + public static implicit operator Data(ExpirationChangeLedgerEntry value) => + new DataVariants::ExpirationChangeLedgerEntryVariant(value); - public static DataVariants::CreditBlockExpiryLedgerEntry Create( - Ledger::CreditBlockExpiryLedgerEntry value - ) => new(value); + public static implicit operator Data(CreditBlockExpiryLedgerEntry value) => + new DataVariants::CreditBlockExpiryLedgerEntryVariant(value); - public static DataVariants::VoidLedgerEntry Create(Ledger::VoidLedgerEntry value) => new(value); + public static implicit operator Data(VoidLedgerEntry value) => + new DataVariants::VoidLedgerEntryVariant(value); - public static DataVariants::VoidInitiatedLedgerEntry Create( - Ledger::VoidInitiatedLedgerEntry value - ) => new(value); + public static implicit operator Data(VoidInitiatedLedgerEntry value) => + new DataVariants::VoidInitiatedLedgerEntryVariant(value); - public static DataVariants::AmendmentLedgerEntry Create(Ledger::AmendmentLedgerEntry value) => - new(value); + public static implicit operator Data(AmendmentLedgerEntry value) => + new DataVariants::AmendmentLedgerEntryVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/DataVariants/All.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/DataVariants/All.cs index a1fc987e..9e05cc47 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/DataVariants/All.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListPageResponseProperties/DataVariants/All.cs @@ -1,18 +1,13 @@ -using Ledger = Orb.Models.Customers.Credits.Ledger; -using LedgerListPageResponseProperties = Orb.Models.Customers.Credits.Ledger.LedgerListPageResponseProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListPageResponseProperties.DataVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class IncrementLedgerEntry(Ledger::IncrementLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class IncrementLedgerEntryVariant(IncrementLedgerEntry Value) + : Data, + IVariant { - public static IncrementLedgerEntry From(Ledger::IncrementLedgerEntry value) + public static IncrementLedgerEntryVariant From(IncrementLedgerEntry value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class DecrementLedgerEntry(Ledger::DecrementLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class DecrementLedgerEntryVariant(DecrementLedgerEntry Value) + : Data, + IVariant { - public static DecrementLedgerEntry From(Ledger::DecrementLedgerEntry value) + public static DecrementLedgerEntryVariant From(DecrementLedgerEntry value) { return new(value); } @@ -41,14 +34,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class ExpirationChangeLedgerEntry(Ledger::ExpirationChangeLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +public sealed record class ExpirationChangeLedgerEntryVariant(ExpirationChangeLedgerEntry Value) + : Data, + IVariant { - public static ExpirationChangeLedgerEntry From(Ledger::ExpirationChangeLedgerEntry value) + public static ExpirationChangeLedgerEntryVariant From(ExpirationChangeLedgerEntry value) { return new(value); } @@ -59,17 +52,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - CreditBlockExpiryLedgerEntry, - Ledger::CreditBlockExpiryLedgerEntry - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class CreditBlockExpiryLedgerEntry(Ledger::CreditBlockExpiryLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +public sealed record class CreditBlockExpiryLedgerEntryVariant(CreditBlockExpiryLedgerEntry Value) + : Data, + IVariant { - public static CreditBlockExpiryLedgerEntry From(Ledger::CreditBlockExpiryLedgerEntry value) + public static CreditBlockExpiryLedgerEntryVariant From(CreditBlockExpiryLedgerEntry value) { return new(value); } @@ -80,14 +70,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidLedgerEntry(Ledger::VoidLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidLedgerEntryVariant(VoidLedgerEntry Value) + : Data, + IVariant { - public static VoidLedgerEntry From(Ledger::VoidLedgerEntry value) + public static VoidLedgerEntryVariant From(VoidLedgerEntry value) { return new(value); } @@ -98,14 +86,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class VoidInitiatedLedgerEntry(Ledger::VoidInitiatedLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class VoidInitiatedLedgerEntryVariant(VoidInitiatedLedgerEntry Value) + : Data, + IVariant { - public static VoidInitiatedLedgerEntry From(Ledger::VoidInitiatedLedgerEntry value) + public static VoidInitiatedLedgerEntryVariant From(VoidInitiatedLedgerEntry value) { return new(value); } @@ -116,14 +102,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmendmentLedgerEntry(Ledger::AmendmentLedgerEntry Value) - : LedgerListPageResponseProperties::Data, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmendmentLedgerEntryVariant(AmendmentLedgerEntry Value) + : Data, + IVariant { - public static AmendmentLedgerEntry From(Ledger::AmendmentLedgerEntry value) + public static AmendmentLedgerEntryVariant From(AmendmentLedgerEntry value) { return new(value); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListParams.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListParams.cs index fe2f6109..c1cb9ae2 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListParams.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; +using System.Net.Http; +using System.Text.Json; using LedgerListParamsProperties = Orb.Models.Customers.Credits.Ledger.LedgerListParamsProperties; -using Orb = Orb; using System = System; namespace Orb.Models.Customers.Credits.Ledger; @@ -73,7 +72,7 @@ namespace Orb.Models.Customers.Credits.Ledger; /// correction, this entry will be added to the ledger to indicate the adjustment /// of credits. /// -public sealed record class LedgerListParams : Orb::ParamsBase +public sealed record class LedgerListParams : ParamsBase { public required string CustomerID; @@ -81,64 +80,48 @@ public sealed record class LedgerListParams : Orb::ParamsBase { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -148,12 +131,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -164,43 +147,36 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } public LedgerListParamsProperties::EntryStatus? EntryStatus { get { - if (!this.QueryProperties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("entry_status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); - } - set - { - this.QueryProperties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public LedgerListParamsProperties::EntryType? EntryType { get { - if (!this.QueryProperties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("entry_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["entry_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -210,30 +186,27 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } public string? MinimumAmount { get { - if (!this.QueryProperties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -244,12 +217,12 @@ public string? MinimumAmount }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryStatus.cs index 41e3b1de..0201b7cd 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryType.cs index bef10c98..dd4e2011 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/LedgerListParamsProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.LedgerListParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType Increment = new("increment"); @@ -44,7 +43,7 @@ public Value Known() => "void" => Value.Void, "void_initiated" => Value.VoidInitiated, "amendment" => Value.Amendment, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntry.cs index 444a3b9c..1ee93792 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntry.cs @@ -1,196 +1,185 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using VoidInitiatedLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.VoidInitiatedLedgerEntryProperties; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class VoidInitiatedLedgerEntry - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class VoidInitiatedLedgerEntry : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required VoidInitiatedLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required VoidInitiatedLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -200,90 +189,80 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime NewBlockExpiryDate { get { - if ( - !this.Properties.TryGetValue("new_block_expiry_date", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("new_block_expiry_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "new_block_expiry_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["new_block_expiry_date"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["new_block_expiry_date"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public required double VoidAmount { get { - if (!this.Properties.TryGetValue("void_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("void_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "void_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["void_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["void_amount"] = JsonSerializer.SerializeToElement(value); } } public required string? VoidReason { get { - if (!this.Properties.TryGetValue("void_reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("void_reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "void_reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["void_reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["void_reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -312,15 +291,15 @@ public override void Validate() public VoidInitiatedLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - VoidInitiatedLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + VoidInitiatedLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static VoidInitiatedLedgerEntry FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryStatus.cs index dd052039..b8f82310 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.VoidInitiatedLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryType.cs index 1cdd66ae..a202f27f 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/VoidInitiatedLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.VoidInitiatedLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType VoidInitiated = new("void_initiated"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "void_initiated" => Value.VoidInitiated, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntry.cs b/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntry.cs index bdc3a630..e377644e 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntry.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntry.cs @@ -1,192 +1,183 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using VoidLedgerEntryProperties = Orb.Models.Customers.Credits.Ledger.VoidLedgerEntryProperties; namespace Orb.Models.Customers.Credits.Ledger; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class VoidLedgerEntry : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class VoidLedgerEntry : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required double Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required AffectedBlock CreditBlock { get { - if (!this.Properties.TryGetValue("credit_block", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_block", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_block", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_block"); } - set { this.Properties["credit_block"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_block"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified Customer + public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } public required double EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } public required VoidLedgerEntryProperties::EntryStatus EntryStatus { get { - if (!this.Properties.TryGetValue("entry_status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("entry_status"); } - set { this.Properties["entry_status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_status"] = JsonSerializer.SerializeToElement(value); } } public required VoidLedgerEntryProperties::EntryType EntryType { get { - if (!this.Properties.TryGetValue("entry_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("entry_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "entry_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("entry_type"); } - set { this.Properties["entry_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["entry_type"] = JsonSerializer.SerializeToElement(value); } } public required long LedgerSequenceNumber { get { - if ( - !this.Properties.TryGetValue( - "ledger_sequence_number", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("ledger_sequence_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ledger_sequence_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["ledger_sequence_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["ledger_sequence_number"] = JsonSerializer.SerializeToElement(value); } } @@ -196,68 +187,65 @@ public required long LedgerSequenceNumber /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required double StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public required double VoidAmount { get { - if (!this.Properties.TryGetValue("void_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("void_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "void_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["void_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["void_amount"] = JsonSerializer.SerializeToElement(value); } } public required string? VoidReason { get { - if (!this.Properties.TryGetValue("void_reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("void_reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "void_reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["void_reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["void_reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -285,16 +273,14 @@ public override void Validate() public VoidLedgerEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - VoidLedgerEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + VoidLedgerEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static VoidLedgerEntry FromRawUnchecked( - Generic::Dictionary properties - ) + public static VoidLedgerEntry FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryStatus.cs b/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryStatus.cs index 2c681c03..d6e42d3c 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryStatus.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryStatus.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.VoidLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryStatus(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryStatus(string value) : IEnum { public static readonly EntryStatus Committed = new("committed"); @@ -24,7 +23,7 @@ public Value Known() => { "committed" => Value.Committed, "pending" => Value.Pending, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryType.cs b/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryType.cs index ac7928bd..8b44530b 100644 --- a/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryType.cs +++ b/src/Orb/Models/Customers/Credits/Ledger/VoidLedgerEntryProperties/EntryType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.Ledger.VoidLedgerEntryProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class EntryType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class EntryType(string value) : IEnum { public static readonly EntryType Void = new("void"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "void" => Value.Void, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParams.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParams.cs index 61e38564..e90cdf3c 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using TopUpCreateByExternalIDParamsProperties = Orb.Models.Customers.Credits.TopUps.TopUpCreateByExternalIDParamsProperties; namespace Orb.Models.Customers.Credits.TopUps; @@ -16,9 +15,9 @@ namespace Orb.Models.Customers.Credits.TopUps; /// If a top-up already exists for this customer in the same currency, the existing /// top-up will be replaced. /// -public sealed record class TopUpCreateByExternalIDParams : Orb::ParamsBase +public sealed record class TopUpCreateByExternalIDParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ExternalCustomerID; @@ -29,16 +28,13 @@ public required string Amount { get { - if (!this.BodyProperties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.BodyProperties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -49,16 +45,13 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -68,22 +61,17 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("invoice_settings", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("invoice_settings", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_settings", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("invoice_settings"); - } - set - { - this.BodyProperties["invoice_settings"] = Json::JsonSerializer.SerializeToElement( - value - ); + ) ?? throw new ArgumentNullException("invoice_settings"); } + set { this.BodyProperties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,25 +81,18 @@ public required string PerUnitCostBasis { get { - if ( - !this.BodyProperties.TryGetValue( - "per_unit_cost_basis", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("per_unit_cost_basis"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("per_unit_cost_basis"); } set { - this.BodyProperties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } @@ -123,32 +104,29 @@ public required string Threshold { get { - if (!this.BodyProperties.TryGetValue("threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "threshold", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException("threshold", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("threshold"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("threshold"); } - set { this.BodyProperties["threshold"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["threshold"] = JsonSerializer.SerializeToElement(value); } } /// /// The date from which the top-up is active. If unspecified, the top-up is active /// immediately. This should not be more than 10 days in the past. /// - public System::DateTime? ActiveFrom + public DateTime? ActiveFrom { get { - if (!this.BodyProperties.TryGetValue("active_from", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("active_from", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["active_from"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["active_from"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,15 +137,12 @@ public long? ExpiresAfter { get { - if (!this.BodyProperties.TryGetValue("expires_after", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("expires_after", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["expires_after"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["expires_after"] = JsonSerializer.SerializeToElement(value); } } /// @@ -177,29 +152,22 @@ public long? ExpiresAfter { get { - if ( - !this.BodyProperties.TryGetValue( - "expires_after_unit", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("expires_after_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.BodyProperties["expires_after_unit"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["expires_after_unit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/customers/external_customer_id/{0}/credits/top_ups", @@ -211,21 +179,21 @@ public long? ExpiresAfter }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/ExpiresAfterUnit.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/ExpiresAfterUnit.cs index 84e4b445..267a046f 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/ExpiresAfterUnit.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/ExpiresAfterUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpCreateByExternalIDParamsProperties; /// /// The unit of expires_after. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExpiresAfterUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExpiresAfterUnit(string value) : IEnum { public static readonly ExpiresAfterUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/InvoiceSettings.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/InvoiceSettings.cs index 319ceb46..0b501613 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/InvoiceSettings.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDParamsProperties/InvoiceSettings.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpCreateByExternalIDParamsProperties; /// /// Settings for invoices generated by triggered top-ups. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class InvoiceSettings : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class InvoiceSettings : ModelBase, IFromRaw { /// /// Whether the credits purchase invoice should auto collect with the customer's @@ -21,15 +20,15 @@ public required bool AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) + throw new ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,15 +40,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "net_terms", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) + throw new ArgumentOutOfRangeException("net_terms", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,12 +55,12 @@ public string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,19 +73,14 @@ public bool? RequireSuccessfulPayment { get { - if ( - !this.Properties.TryGetValue( - "require_successful_payment", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("require_successful_payment", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["require_successful_payment"] = Json::JsonSerializer.SerializeToElement( + this.Properties["require_successful_payment"] = JsonSerializer.SerializeToElement( value ); } @@ -106,16 +97,14 @@ public override void Validate() public InvoiceSettings() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceSettings(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceSettings(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static InvoiceSettings FromRawUnchecked( - Generic::Dictionary properties - ) + public static InvoiceSettings FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponse.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponse.cs index f43b8e0a..ec8aa824 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponse.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponse.cs @@ -1,29 +1,28 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using TopUpCreateByExternalIDResponseProperties = Orb.Models.Customers.Credits.TopUps.TopUpCreateByExternalIDResponseProperties; namespace Orb.Models.Customers.Credits.TopUps; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class TopUpCreateByExternalIDResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -33,16 +32,13 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,16 +49,13 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,19 +65,16 @@ public required TopUpInvoiceSettings InvoiceSettings { get { - if (!this.Properties.TryGetValue("invoice_settings", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoice_settings", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_settings", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoice_settings"); - } - set - { - this.Properties["invoice_settings"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_settings"); } + set { this.Properties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,19 +84,16 @@ public required string PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("per_unit_cost_basis"); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("per_unit_cost_basis"); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,16 +104,13 @@ public required string Threshold { get { - if (!this.Properties.TryGetValue("threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "threshold", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException("threshold", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("threshold"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("threshold"); } - set { this.Properties["threshold"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["threshold"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,12 +121,12 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expires_after"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expires_after"] = JsonSerializer.SerializeToElement(value); } } /// @@ -152,17 +136,14 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.Properties["expires_after_unit"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["expires_after_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -180,15 +161,15 @@ public override void Validate() public TopUpCreateByExternalIDResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TopUpCreateByExternalIDResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + TopUpCreateByExternalIDResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static TopUpCreateByExternalIDResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponseProperties/ExpiresAfterUnit.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponseProperties/ExpiresAfterUnit.cs index 95ff6c09..d14ff03b 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponseProperties/ExpiresAfterUnit.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateByExternalIDResponseProperties/ExpiresAfterUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpCreateByExternalIDResponseProperties; /// /// The unit of expires_after. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExpiresAfterUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExpiresAfterUnit(string value) : IEnum { public static readonly ExpiresAfterUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParams.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParams.cs index 4000697b..959c9ef4 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParams.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using TopUpCreateParamsProperties = Orb.Models.Customers.Credits.TopUps.TopUpCreateParamsProperties; namespace Orb.Models.Customers.Credits.TopUps; @@ -16,9 +15,9 @@ namespace Orb.Models.Customers.Credits.TopUps; /// If a top-up already exists for this customer in the same currency, the existing /// top-up will be replaced. /// -public sealed record class TopUpCreateParams : Orb::ParamsBase +public sealed record class TopUpCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string CustomerID; @@ -29,16 +28,13 @@ public required string Amount { get { - if (!this.BodyProperties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.BodyProperties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -49,16 +45,13 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -68,22 +61,16 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("invoice_settings", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("invoice_settings", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_settings", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("invoice_settings"); - } - set - { - this.BodyProperties["invoice_settings"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_settings"); } + set { this.BodyProperties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,25 +80,18 @@ public required string PerUnitCostBasis { get { - if ( - !this.BodyProperties.TryGetValue( - "per_unit_cost_basis", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("per_unit_cost_basis"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("per_unit_cost_basis"); } set { - this.BodyProperties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } @@ -123,32 +103,29 @@ public required string Threshold { get { - if (!this.BodyProperties.TryGetValue("threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "threshold", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException("threshold", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("threshold"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("threshold"); } - set { this.BodyProperties["threshold"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["threshold"] = JsonSerializer.SerializeToElement(value); } } /// /// The date from which the top-up is active. If unspecified, the top-up is active /// immediately. This should not be more than 10 days in the past. /// - public System::DateTime? ActiveFrom + public DateTime? ActiveFrom { get { - if (!this.BodyProperties.TryGetValue("active_from", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("active_from", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["active_from"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["active_from"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,15 +136,12 @@ public long? ExpiresAfter { get { - if (!this.BodyProperties.TryGetValue("expires_after", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("expires_after", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["expires_after"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["expires_after"] = JsonSerializer.SerializeToElement(value); } } /// @@ -177,29 +151,22 @@ public long? ExpiresAfter { get { - if ( - !this.BodyProperties.TryGetValue( - "expires_after_unit", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("expires_after_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.BodyProperties["expires_after_unit"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["expires_after_unit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/customers/{0}/credits/top_ups", this.CustomerID) ) @@ -208,21 +175,21 @@ public long? ExpiresAfter }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/ExpiresAfterUnit.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/ExpiresAfterUnit.cs index 68057409..ed6200c7 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/ExpiresAfterUnit.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/ExpiresAfterUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpCreateParamsProperties; /// /// The unit of expires_after. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExpiresAfterUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExpiresAfterUnit(string value) : IEnum { public static readonly ExpiresAfterUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/InvoiceSettings.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/InvoiceSettings.cs index b4d87859..7ee4f3e7 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/InvoiceSettings.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateParamsProperties/InvoiceSettings.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpCreateParamsProperties; /// /// Settings for invoices generated by triggered top-ups. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class InvoiceSettings : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class InvoiceSettings : ModelBase, IFromRaw { /// /// Whether the credits purchase invoice should auto collect with the customer's @@ -21,15 +20,15 @@ public required bool AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) + throw new ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,15 +40,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "net_terms", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) + throw new ArgumentOutOfRangeException("net_terms", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,12 +55,12 @@ public string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,19 +73,14 @@ public bool? RequireSuccessfulPayment { get { - if ( - !this.Properties.TryGetValue( - "require_successful_payment", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("require_successful_payment", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["require_successful_payment"] = Json::JsonSerializer.SerializeToElement( + this.Properties["require_successful_payment"] = JsonSerializer.SerializeToElement( value ); } @@ -106,16 +97,14 @@ public override void Validate() public InvoiceSettings() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceSettings(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceSettings(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static InvoiceSettings FromRawUnchecked( - Generic::Dictionary properties - ) + public static InvoiceSettings FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponse.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponse.cs index 87dc4c19..3055de5f 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponse.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponse.cs @@ -1,27 +1,26 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using TopUpCreateResponseProperties = Orb.Models.Customers.Credits.TopUps.TopUpCreateResponseProperties; namespace Orb.Models.Customers.Credits.TopUps; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TopUpCreateResponse : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TopUpCreateResponse : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -31,16 +30,13 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -51,16 +47,13 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -70,19 +63,16 @@ public required TopUpInvoiceSettings InvoiceSettings { get { - if (!this.Properties.TryGetValue("invoice_settings", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoice_settings", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_settings", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoice_settings"); - } - set - { - this.Properties["invoice_settings"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_settings"); } + set { this.Properties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -92,19 +82,16 @@ public required string PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("per_unit_cost_basis"); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("per_unit_cost_basis"); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } /// @@ -115,16 +102,13 @@ public required string Threshold { get { - if (!this.Properties.TryGetValue("threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "threshold", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException("threshold", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("threshold"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("threshold"); } - set { this.Properties["threshold"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["threshold"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,12 +119,12 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expires_after"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expires_after"] = JsonSerializer.SerializeToElement(value); } } /// @@ -150,17 +134,14 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.Properties["expires_after_unit"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["expires_after_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -178,16 +159,14 @@ public override void Validate() public TopUpCreateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TopUpCreateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + TopUpCreateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TopUpCreateResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static TopUpCreateResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponseProperties/ExpiresAfterUnit.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponseProperties/ExpiresAfterUnit.cs index 9bae42ed..470c9f77 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponseProperties/ExpiresAfterUnit.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpCreateResponseProperties/ExpiresAfterUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpCreateResponseProperties; /// /// The unit of expires_after. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExpiresAfterUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExpiresAfterUnit(string value) : IEnum { public static readonly ExpiresAfterUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteByExternalIDParams.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteByExternalIDParams.cs index 494b787b..def340fc 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteByExternalIDParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Customers.Credits.TopUps; @@ -8,15 +7,15 @@ namespace Orb.Models.Customers.Credits.TopUps; /// This deactivates the top-up and voids any invoices associated with pending credit /// blocks purchased through the top-up. /// -public sealed record class TopUpDeleteByExternalIDParams : Orb::ParamsBase +public sealed record class TopUpDeleteByExternalIDParams : ParamsBase { public required string ExternalCustomerID; public required string TopUpID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/customers/external_customer_id/{0}/credits/top_ups/{1}", @@ -29,12 +28,12 @@ public sealed record class TopUpDeleteByExternalIDParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteParams.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteParams.cs index a082888c..31b53e96 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteParams.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpDeleteParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Customers.Credits.TopUps; @@ -8,15 +7,15 @@ namespace Orb.Models.Customers.Credits.TopUps; /// This deactivates the top-up and voids any invoices associated with pending credit /// blocks purchased through the top-up. /// -public sealed record class TopUpDeleteParams : Orb::ParamsBase +public sealed record class TopUpDeleteParams : ParamsBase { public required string CustomerID; public required string TopUpID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/customers/{0}/credits/top_ups/{1}", this.CustomerID, this.TopUpID) ) @@ -25,12 +24,12 @@ public sealed record class TopUpDeleteParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpInvoiceSettings.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpInvoiceSettings.cs index e81b2f85..bd2df598 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpInvoiceSettings.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpInvoiceSettings.cs @@ -1,16 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TopUpInvoiceSettings - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TopUpInvoiceSettings : ModelBase, IFromRaw { /// /// Whether the credits purchase invoice should auto collect with the customer's @@ -20,15 +17,15 @@ public required bool AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) + throw new ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,15 +37,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "net_terms", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) + throw new ArgumentOutOfRangeException("net_terms", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -58,12 +52,12 @@ public string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,19 +70,14 @@ public bool? RequireSuccessfulPayment { get { - if ( - !this.Properties.TryGetValue( - "require_successful_payment", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("require_successful_payment", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["require_successful_payment"] = Json::JsonSerializer.SerializeToElement( + this.Properties["require_successful_payment"] = JsonSerializer.SerializeToElement( value ); } @@ -105,16 +94,14 @@ public override void Validate() public TopUpInvoiceSettings() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TopUpInvoiceSettings(Generic::Dictionary properties) + [SetsRequiredMembers] + TopUpInvoiceSettings(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TopUpInvoiceSettings FromRawUnchecked( - Generic::Dictionary properties - ) + public static TopUpInvoiceSettings FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponse.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponse.cs index 90d20553..83064620 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponse.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponse.cs @@ -1,50 +1,46 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TopUpListByExternalIDPageResponseProperties = Orb.Models.Customers.Credits.TopUps.TopUpListByExternalIDPageResponseProperties; namespace Orb.Models.Customers.Credits.TopUps; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class TopUpListByExternalIDPageResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +55,15 @@ public override void Validate() public TopUpListByExternalIDPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TopUpListByExternalIDPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + TopUpListByExternalIDPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static TopUpListByExternalIDPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/Data.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/Data.cs index 13adcabc..8c6289e7 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/Data.cs @@ -1,28 +1,26 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Customers.Credits.TopUps.TopUpListByExternalIDPageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; -using TopUps = Orb.Models.Customers.Credits.TopUps; namespace Orb.Models.Customers.Credits.TopUps.TopUpListByExternalIDPageResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -32,16 +30,13 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -52,38 +47,32 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// Settings for invoices generated by triggered top-ups. /// - public required TopUps::TopUpInvoiceSettings InvoiceSettings + public required TopUpInvoiceSettings InvoiceSettings { get { - if (!this.Properties.TryGetValue("invoice_settings", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoice_settings", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_settings", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoice_settings"); - } - set - { - this.Properties["invoice_settings"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_settings"); } + set { this.Properties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,19 +82,16 @@ public required string PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("per_unit_cost_basis"); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("per_unit_cost_basis"); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,16 +102,13 @@ public required string Threshold { get { - if (!this.Properties.TryGetValue("threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "threshold", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException("threshold", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("threshold"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("threshold"); } - set { this.Properties["threshold"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["threshold"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,12 +119,12 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expires_after"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expires_after"] = JsonSerializer.SerializeToElement(value); } } /// @@ -151,15 +134,12 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["expires_after_unit"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["expires_after_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -177,14 +157,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/DataProperties/ExpiresAfterUnit.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/DataProperties/ExpiresAfterUnit.cs index d384ea7c..cb9ddc31 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/DataProperties/ExpiresAfterUnit.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDPageResponseProperties/DataProperties/ExpiresAfterUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpListByExternalIDPageResponseProperties.DataProperties; /// /// The unit of expires_after. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExpiresAfterUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExpiresAfterUnit(string value) : IEnum { public static readonly ExpiresAfterUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDParams.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDParams.cs index 47f98be1..07fd1856 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDParams.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListByExternalIDParams.cs @@ -1,14 +1,13 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Customers.Credits.TopUps; /// /// List top-ups by external ID /// -public sealed record class TopUpListByExternalIDParams : Orb::ParamsBase +public sealed record class TopUpListByExternalIDParams : ParamsBase { public required string ExternalCustomerID; @@ -20,12 +19,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,17 +34,17 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/customers/external_customer_id/{0}/credits/top_ups", @@ -57,12 +56,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponse.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponse.cs index 0b09f252..a55aa7e9 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponse.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponse.cs @@ -1,50 +1,43 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TopUpListPageResponseProperties = Orb.Models.Customers.Credits.TopUps.TopUpListPageResponseProperties; namespace Orb.Models.Customers.Credits.TopUps; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TopUpListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TopUpListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,16 +52,14 @@ public override void Validate() public TopUpListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TopUpListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + TopUpListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TopUpListPageResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static TopUpListPageResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/Data.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/Data.cs index 2009e34c..eac58ae6 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/Data.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/Data.cs @@ -1,28 +1,26 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Customers.Credits.TopUps.TopUpListPageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; -using TopUps = Orb.Models.Customers.Credits.TopUps; namespace Orb.Models.Customers.Credits.TopUps.TopUpListPageResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -32,16 +30,13 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -52,38 +47,32 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// Settings for invoices generated by triggered top-ups. /// - public required TopUps::TopUpInvoiceSettings InvoiceSettings + public required TopUpInvoiceSettings InvoiceSettings { get { - if (!this.Properties.TryGetValue("invoice_settings", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoice_settings", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoice_settings", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoice_settings"); - } - set - { - this.Properties["invoice_settings"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_settings"); } + set { this.Properties["invoice_settings"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,19 +82,16 @@ public required string PerUnitCostBasis { get { - if (!this.Properties.TryGetValue("per_unit_cost_basis", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("per_unit_cost_basis", out JsonElement element)) + throw new ArgumentOutOfRangeException( "per_unit_cost_basis", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("per_unit_cost_basis"); - } - set - { - this.Properties["per_unit_cost_basis"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("per_unit_cost_basis"); } + set { this.Properties["per_unit_cost_basis"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,16 +102,13 @@ public required string Threshold { get { - if (!this.Properties.TryGetValue("threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "threshold", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException("threshold", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("threshold"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("threshold"); } - set { this.Properties["threshold"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["threshold"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,12 +119,12 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expires_after"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expires_after"] = JsonSerializer.SerializeToElement(value); } } /// @@ -151,15 +134,12 @@ public long? ExpiresAfter { get { - if (!this.Properties.TryGetValue("expires_after_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("expires_after_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["expires_after_unit"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["expires_after_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -177,14 +157,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/DataProperties/ExpiresAfterUnit.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/DataProperties/ExpiresAfterUnit.cs index e88d0a82..8eb683a6 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/DataProperties/ExpiresAfterUnit.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListPageResponseProperties/DataProperties/ExpiresAfterUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.Credits.TopUps.TopUpListPageResponseProperties.DataProperties; /// /// The unit of expires_after. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExpiresAfterUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExpiresAfterUnit(string value) : IEnum { public static readonly ExpiresAfterUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/Credits/TopUps/TopUpListParams.cs b/src/Orb/Models/Customers/Credits/TopUps/TopUpListParams.cs index f434b8af..7c3eadd9 100644 --- a/src/Orb/Models/Customers/Credits/TopUps/TopUpListParams.cs +++ b/src/Orb/Models/Customers/Credits/TopUps/TopUpListParams.cs @@ -1,14 +1,13 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Customers.Credits.TopUps; /// /// List top-ups /// -public sealed record class TopUpListParams : Orb::ParamsBase +public sealed record class TopUpListParams : ParamsBase { public required string CustomerID; @@ -20,12 +19,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,17 +34,17 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/customers/{0}/credits/top_ups", this.CustomerID) ) @@ -54,12 +53,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/Customer.cs b/src/Orb/Models/Customers/Customer.cs index d9c71b39..34004afa 100644 --- a/src/Orb/Models/Customers/Customer.cs +++ b/src/Orb/Models/Customers/Customer.cs @@ -1,10 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CustomerProperties = Orb.Models.Customers.CustomerProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; @@ -26,54 +24,51 @@ namespace Orb.Models.Customers; /// which defaults to your account's timezone. See [Timezone localization](/essentials/timezones) /// for information on what this timezone parameter influences within Orb. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Customer : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Customer : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List AdditionalEmails + public required List AdditionalEmails { get { - if (!this.Properties.TryGetValue("additional_emails", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("additional_emails", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "additional_emails", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("additional_emails"); } - set - { - this.Properties["additional_emails"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["additional_emails"] = JsonSerializer.SerializeToElement(value); } } public required bool AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,61 +78,61 @@ public required string Balance { get { - if (!this.Properties.TryGetValue("balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("balance"); } - set { this.Properties["balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["balance"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Address? BillingAddress + public required Address? BillingAddress { get { - if (!this.Properties.TryGetValue("billing_address", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billing_address", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "billing_address", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billing_address"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billing_address"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -148,52 +143,45 @@ public required string Email { get { - if (!this.Properties.TryGetValue("email", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("email", out JsonElement element)) throw new System::ArgumentOutOfRangeException("email", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("email"); } - set { this.Properties["email"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["email"] = JsonSerializer.SerializeToElement(value); } } public required bool EmailDelivery { get { - if (!this.Properties.TryGetValue("email_delivery", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("email_delivery", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "email_delivery", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["email_delivery"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["email_delivery"] = JsonSerializer.SerializeToElement(value); } } public required bool? ExemptFromAutomatedTax { get { - if ( - !this.Properties.TryGetValue( - "exempt_from_automated_tax", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("exempt_from_automated_tax", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "exempt_from_automated_tax", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["exempt_from_automated_tax"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["exempt_from_automated_tax"] = JsonSerializer.SerializeToElement(value); } } @@ -206,20 +194,15 @@ public required string? ExternalCustomerID { get { - if (!this.Properties.TryGetValue("external_customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_customer_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "external_customer_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -229,16 +212,16 @@ public required string? ExternalCustomerID { get { - if (!this.Properties.TryGetValue("hierarchy", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("hierarchy", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "hierarchy", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("hierarchy"); } - set { this.Properties["hierarchy"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["hierarchy"] = JsonSerializer.SerializeToElement(value); } } /// @@ -247,20 +230,20 @@ public required string? ExternalCustomerID /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -270,13 +253,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -287,18 +270,15 @@ public required string Name { get { - if (!this.Properties.TryGetValue("payment_provider", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_provider", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_provider", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_provider"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_provider"] = JsonSerializer.SerializeToElement(value); } } /// @@ -309,51 +289,45 @@ public required string? PaymentProviderID { get { - if (!this.Properties.TryGetValue("payment_provider_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_provider_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_provider_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_provider_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_provider_id"] = JsonSerializer.SerializeToElement(value); } } public required string? PortalURL { get { - if (!this.Properties.TryGetValue("portal_url", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("portal_url", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "portal_url", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["portal_url"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["portal_url"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Address? ShippingAddress + public required Address? ShippingAddress { get { - if (!this.Properties.TryGetValue("shipping_address", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("shipping_address", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "shipping_address", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["shipping_address"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["shipping_address"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,125 +336,116 @@ public required string? PortalURL /// /// ### Supported Tax ID Countries and Types /// - /// | Country | Type | Description - /// | |----------------|--------------|---------------------------------------------| - /// | Andorra | `ad_nrt` | Andorran NRT Number - /// | | Argentina | `ar_cuit` | Argentinian Tax ID Number - /// | | Australia | `au_abn` | Australian Business Number (AU ABN) - /// | | Australia | `au_arn` | Australian Taxation Office - /// Reference Number | | Austria | `eu_vat` | European VAT Number - /// | | Bahrain | `bh_vat` | Bahraini VAT Number - /// | | Belgium | `eu_vat` | European VAT Number - /// | | Bolivia | `bo_tin` | Bolivian Tax ID - /// | | Brazil | `br_cnpj` | Brazilian CNPJ - /// Number | | Brazil | `br_cpf` | Brazilian CPF - /// Number | | Bulgaria | `bg_uic` | Bulgaria - /// Unified Identification Code | | Bulgaria | `eu_vat` | European - /// VAT Number | | Canada | `ca_bn` | Canadian - /// BN | | Canada | `ca_gst_hst` | Canadian - /// GST/HST Number | | Canada | `ca_pst_bc` | Canadian - /// PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian - /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian - /// PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian - /// QST Number (Québec) | | Chile | `cl_tin` | Chilean - /// TIN | | China | `cn_tin` | Chinese - /// Tax ID | | Colombia | `co_nit` | Colombian - /// NIT Number | | Costa Rica | `cr_tin` | Costa - /// Rican Tax ID | | Croatia | `eu_vat` | European - /// VAT Number | | Cyprus | `eu_vat` | European - /// VAT Number | | Czech Republic | `eu_vat` | European - /// VAT Number | | Denmark | `eu_vat` | European - /// VAT Number | | Dominican Republic | `do_rcn` | Dominican - /// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian - /// RUC Number | | Egypt | `eg_tin` | Egyptian - /// Tax Identification Number | | El Salvador | `sv_nit` - /// | El Salvadorian NIT Number | | Estonia | `eu_vat` | - /// European VAT Number | | EU | `eu_oss_vat` | European One Stop Shop - /// VAT Number for non-Union scheme | | Finland | `eu_vat` | European VAT - /// Number | | France | `eu_vat` | European - /// VAT Number | | Georgia | `ge_vat` | - /// Georgian VAT | | Germany | `eu_vat` - /// | European VAT Number | | Greece - /// | `eu_vat` | European VAT Number | | - /// Hong Kong | `hk_br` | Hong Kong BR Number - /// | | Hungary | `eu_vat` | European VAT Number - /// | | Hungary | `hu_tin` | Hungary Tax Number (adószám) - /// | | Iceland | `is_vat` | Icelandic VAT - /// | | India | `in_gst` | Indian GST - /// Number | | Indonesia | `id_npwp` | Indonesian - /// NPWP Number | | Ireland | `eu_vat` | - /// European VAT Number | | Israel | `il_vat` - /// | Israel VAT | | Italy - /// | `eu_vat` | European VAT Number | | - /// Japan | `jp_cn` | Japanese Corporate Number (*Hōjin Bangō*) - /// | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' - /// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | - /// Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) - /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification - /// Number | | Kenya | `ke_pin` | Kenya Revenue Authority - /// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number - /// | | Liechtenstein | `li_uid` | Liechtensteinian - /// UID Number | | Lithuania | `eu_vat` | European VAT Number - /// | | Luxembourg | `eu_vat` | European VAT Number - /// | | Malaysia | `my_frp` | Malaysian FRP Number - /// | | Malaysia | `my_itn` | Malaysian ITN - /// | | Malaysia | `my_sst` | Malaysian SST Number | - /// | Malta | `eu_vat ` | European VAT Number | | Mexico - /// | `mx_rfc` | Mexican RFC Number | | Netherlands - /// | `eu_vat` | European VAT Number | | New Zealand | - /// `nz_gst` | New Zealand GST Number | | Nigeria | - /// `ng_tin` | Nigerian Tax Identification Number | | Norway | `no_vat` - /// | Norwegian VAT Number | | Norway | `no_voec` | Norwegian - /// VAT on e-commerce Number | | Oman | `om_vat` | Omani VAT Number - /// | | Peru | `pe_ruc` | Peruvian RUC Number - /// | | Philippines | `ph_tin ` | Philippines Tax Identification - /// Number | | Poland | `eu_vat` | European VAT Number - /// | | Portugal | `eu_vat` | European VAT Number | | - /// Romania | `eu_vat` | European VAT Number | | Romania - /// | `ro_tin` | Romanian Tax ID Number | | Russia - /// | `ru_inn` | Russian INN | | Russia | `ru_kpp` - /// | Russian KPP | | Saudi Arabia | `sa_vat` | Saudi - /// Arabia VAT | | Serbia | `rs_pib` | Serbian PIB - /// Number | | Singapore | `sg_gst` | Singaporean GST - /// | | Singapore | `sg_uen` | Singaporean UEN - /// | | Slovakia | `eu_vat` | European VAT Number - /// | | Slovenia | `eu_vat` | European VAT Number - /// | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) - /// | | South Africa | `za_vat` | South African VAT - /// Number | | South Korea | `kr_brn` | Korean - /// BRN | | Spain | `es_cif` - /// | Spanish NIF Number (previously Spanish CIF Number) | | Spain - /// | `eu_vat` | European VAT Number | | - /// Sweden | `eu_vat` | European VAT Number - /// | | Switzerland | `ch_vat` | Switzerland VAT Number - /// | | Taiwan | `tw_vat` | Taiwanese VAT - /// | | Thailand | `th_vat` | - /// Thai VAT | | Turkey - /// | `tr_tin` | Turkish Tax Identification Number | | Ukraine - /// | `ua_vat` | Ukrainian VAT - /// | | United Arab Emirates | `ae_trn` | United Arab Emirates TRN - /// | | United Kingdom | `eu_vat` | Northern Ireland - /// VAT Number | | United Kingdom | `gb_vat` | United - /// Kingdom VAT Number | | United States | `us_ein` - /// | United States EIN | | Uruguay - /// | `uy_ruc` | Uruguayan RUC Number | | Venezuela - /// | `ve_rif` | Venezuelan RIF Number - /// | | Vietnam | `vn_tin` | Vietnamese Tax ID Number - /// | + /// | Country | Type | Description | |---------|------|-------------| | Albania + /// | `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran + /// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina + /// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax + /// Identification Number | | Aruba | `aw_tin` | Aruba Tax Identification Number + /// | | Australia | `au_abn` | Australian Business Number (AU ABN) | | Australia + /// | `au_arn` | Australian Taxation Office Reference Number | | Austria | `eu_vat` + /// | European VAT Number | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification + /// Number | | Bahamas | `bs_tin` | Bahamas Tax Identification Number | | Bahrain + /// | `bh_vat` | Bahraini VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business + /// Identification Number | | Barbados | `bb_tin` | Barbados Tax Identification + /// Number | | Belarus | `by_tin` | Belarus TIN Number | | Belgium | `eu_vat` | + /// European VAT Number | | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant + /// Fiscal Unique) | | Bolivia | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina + /// | `ba_tin` | Bosnia and Herzegovina Tax Identification Number | | Brazil | `br_cnpj` + /// | Brazilian CNPJ Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria + /// | `bg_uic` | Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | + /// European VAT Number | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification + /// Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia + /// Tax Identification Number | | Cameroon | `cm_niu` | Cameroon Tax Identification + /// Number (Numéro d'Identifiant fiscal Unique) | | Canada | `ca_bn` | Canadian + /// BN | | Canada | `ca_gst_hst` | Canadian GST/HST Number | | Canada | `ca_pst_bc` + /// | Canadian PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian + /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) + /// | | Canada | `ca_qst` | Canadian QST Number (Québec) | | Cape Verde | `cv_nif` + /// | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | + /// Chile | `cl_tin` | Chilean TIN | | China | `cn_tin` | Chinese Tax ID | | Colombia + /// | `co_nit` | Colombian NIT Number | | Congo-Kinshasa | `cd_nif` | Congo (DR) + /// Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | + /// `cr_tin` | Costa Rican Tax ID | | Croatia | `eu_vat` | European VAT Number | + /// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) | | Cyprus + /// | `eu_vat` | European VAT Number | | Czech Republic | `eu_vat` | European VAT + /// Number | | Denmark | `eu_vat` | European VAT Number | | Dominican Republic + /// | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` | Ecuadorian RUC Number + /// | | Egypt | `eg_tin` | Egyptian Tax Identification Number | | El Salvador | + /// `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` | European VAT + /// Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number | | European + /// Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme + /// | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European + /// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German + /// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | + /// Greece | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification + /// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong + /// BR Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` + /// | Hungary Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India + /// | `in_gst` | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP + /// Number | | Ireland | `eu_vat` | European VAT Number | | Israel | `il_vat` | + /// Israel VAT | | Italy | `eu_vat` | European VAT Number | | Japan | `jp_cn` | + /// Japanese Corporate Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered + /// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku + /// Bangō*) | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) + /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number | | + /// Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + /// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number | | Laos | `la_tin` + /// | Laos Tax Identification Number | | Latvia | `eu_vat` | European VAT Number + /// | | Liechtenstein | `li_uid` | Liechtensteinian UID Number | | Liechtenstein + /// | `li_vat` | Liechtenstein VAT Number | | Lithuania | `eu_vat` | European VAT + /// Number | | Luxembourg | `eu_vat` | European VAT Number | | Malaysia | `my_frp` + /// | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian ITN | | Malaysia + /// | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European VAT Number + /// | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de + /// Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova + /// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB + /// Number | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal + /// PAN Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand + /// | `nz_gst` | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification + /// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern + /// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian + /// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman + /// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | + /// Philippines | `ph_tin` | Philippines Tax Identification Number | | Poland | + /// `eu_vat` | European VAT Number | | Portugal | `eu_vat` | European VAT Number + /// | | Romania | `eu_vat` | European VAT Number | | Romania | `ro_tin` | Romanian + /// Tax ID Number | | Russia | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian + /// KPP | | Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` + /// | Senegal NINEA Number | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore + /// | `sg_gst` | Singaporean GST | | Singapore | `sg_uen` | Singaporean UEN | | + /// Slovakia | `eu_vat` | European VAT Number | | Slovenia | `eu_vat` | European + /// VAT Number | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) | + /// | South Africa | `za_vat` | South African VAT Number | | South Korea | `kr_brn` + /// | Korean BRN | | Spain | `es_cif` | Spanish NIF Number (previously Spanish + /// CIF Number) | | Spain | `eu_vat` | European VAT Number | | Suriname | `sr_fin` + /// | Suriname FIN Number | | Sweden | `eu_vat` | European VAT Number | | Switzerland + /// | `ch_uid` | Switzerland UID Number | | Switzerland | `ch_vat` | Switzerland + /// VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | Tajikistan | `tj_tin` + /// | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` | Tanzania VAT + /// Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` | Turkish Tax + /// Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification Number + /// | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` | + /// United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT + /// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` + /// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | + /// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | + /// Venezuelan RIF Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | + /// Zambia | `zm_tin` | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` + /// | Zimbabwe Tax Identification Number | /// - public required Models::CustomerTaxID? TaxID + public required CustomerTaxID? TaxID { get { - if (!this.Properties.TryGetValue("tax_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["tax_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -492,16 +457,16 @@ public required string Timezone { get { - if (!this.Properties.TryGetValue("timezone", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("timezone", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timezone", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("timezone"); } - set { this.Properties["timezone"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timezone"] = JsonSerializer.SerializeToElement(value); } } public CustomerProperties::AccountingSyncConfiguration? AccountingSyncConfiguration @@ -511,19 +476,20 @@ public required string Timezone if ( !this.Properties.TryGetValue( "accounting_sync_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["accounting_sync_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["accounting_sync_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -531,23 +497,14 @@ public required string Timezone { get { - if ( - !this.Properties.TryGetValue( - "reporting_configuration", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("reporting_configuration", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["reporting_configuration"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["reporting_configuration"] = JsonSerializer.SerializeToElement(value); } } @@ -586,16 +543,14 @@ public override void Validate() public Customer() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Customer(Generic::Dictionary properties) + [SetsRequiredMembers] + Customer(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Customer FromRawUnchecked( - Generic::Dictionary properties - ) + public static Customer FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/CustomerCreateParams.cs b/src/Orb/Models/Customers/CustomerCreateParams.cs index 79f899fb..0905ed3f 100644 --- a/src/Orb/Models/Customers/CustomerCreateParams.cs +++ b/src/Orb/Models/Customers/CustomerCreateParams.cs @@ -1,11 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using CustomerCreateParamsProperties = Orb.Models.Customers.CustomerCreateParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Customers; @@ -20,9 +18,9 @@ namespace Orb.Models.Customers; /// can be configured by setting `external_customer_id` * [Timezone localization](/essentials/timezones) /// can be configured on a per-customer basis by setting the `timezone` parameter /// -public sealed record class CustomerCreateParams : Orb::ParamsBase +public sealed record class CustomerCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// A valid customer email, to be used for notifications. When Orb triggers payment @@ -32,13 +30,13 @@ public required string Email { get { - if (!this.BodyProperties.TryGetValue("email", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("email", out JsonElement element)) throw new System::ArgumentOutOfRangeException("email", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("email"); } - set { this.BodyProperties["email"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["email"] = JsonSerializer.SerializeToElement(value); } } /// @@ -48,13 +46,13 @@ public required string Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } public NewAccountingSyncConfiguration? AccountingSyncConfiguration @@ -64,17 +62,17 @@ public NewAccountingSyncConfiguration? AccountingSyncConfiguration if ( !this.BodyProperties.TryGetValue( "accounting_sync_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["accounting_sync_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -82,23 +80,16 @@ public NewAccountingSyncConfiguration? AccountingSyncConfiguration /// Additional email addresses for this customer. If populated, these email addresses /// will be CC'd for customer communications. /// - public Generic::List? AdditionalEmails + public List? AdditionalEmails { get { - if ( - !this.BodyProperties.TryGetValue("additional_emails", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("additional_emails", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.BodyProperties["additional_emails"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.BodyProperties["additional_emails"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,30 +101,24 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("auto_collection", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public AddressInput? BillingAddress { get { - if (!this.BodyProperties.TryGetValue("billing_address", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("billing_address", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["billing_address"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["billing_address"] = JsonSerializer.SerializeToElement(value); } } /// @@ -144,27 +129,24 @@ public string? Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } public bool? EmailDelivery { get { - if (!this.BodyProperties.TryGetValue("email_delivery", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("email_delivery", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["email_delivery"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["email_delivery"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,21 +158,14 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -201,12 +176,12 @@ public CustomerHierarchyConfig? Hierarchy { get { - if (!this.BodyProperties.TryGetValue("hierarchy", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("hierarchy", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["hierarchy"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["hierarchy"] = JsonSerializer.SerializeToElement(value); } } /// @@ -214,16 +189,16 @@ public CustomerHierarchyConfig? Hierarchy /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -234,19 +209,14 @@ public CustomerHierarchyConfig? Hierarchy { get { - if (!this.BodyProperties.TryGetValue("payment_provider", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("payment_provider", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["payment_provider"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["payment_provider"] = JsonSerializer.SerializeToElement(value); } } /// @@ -257,21 +227,14 @@ public string? PaymentProviderID { get { - if ( - !this.BodyProperties.TryGetValue( - "payment_provider_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("payment_provider_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["payment_provider_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["payment_provider_id"] = JsonSerializer.SerializeToElement(value); } } @@ -280,19 +243,17 @@ public NewReportingConfiguration? ReportingConfiguration get { if ( - !this.BodyProperties.TryGetValue( - "reporting_configuration", - out Json::JsonElement element - ) + !this.BodyProperties.TryGetValue("reporting_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["reporting_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["reporting_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -300,38 +261,26 @@ public AddressInput? ShippingAddress { get { - if (!this.BodyProperties.TryGetValue("shipping_address", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("shipping_address", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["shipping_address"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["shipping_address"] = JsonSerializer.SerializeToElement(value); } } public CustomerCreateParamsProperties::TaxConfiguration? TaxConfiguration { get { - if ( - !this.BodyProperties.TryGetValue("tax_configuration", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("tax_configuration", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["tax_configuration"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["tax_configuration"] = JsonSerializer.SerializeToElement(value); } } /// @@ -340,122 +289,113 @@ public AddressInput? ShippingAddress /// /// ### Supported Tax ID Countries and Types /// - /// | Country | Type | Description - /// | |----------------|--------------|---------------------------------------------| - /// | Andorra | `ad_nrt` | Andorran NRT Number - /// | | Argentina | `ar_cuit` | Argentinian Tax ID Number - /// | | Australia | `au_abn` | Australian Business Number (AU ABN) - /// | | Australia | `au_arn` | Australian Taxation Office - /// Reference Number | | Austria | `eu_vat` | European VAT Number - /// | | Bahrain | `bh_vat` | Bahraini VAT Number - /// | | Belgium | `eu_vat` | European VAT Number - /// | | Bolivia | `bo_tin` | Bolivian Tax ID - /// | | Brazil | `br_cnpj` | Brazilian CNPJ - /// Number | | Brazil | `br_cpf` | Brazilian CPF - /// Number | | Bulgaria | `bg_uic` | Bulgaria - /// Unified Identification Code | | Bulgaria | `eu_vat` | European - /// VAT Number | | Canada | `ca_bn` | Canadian - /// BN | | Canada | `ca_gst_hst` | Canadian - /// GST/HST Number | | Canada | `ca_pst_bc` | Canadian - /// PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian - /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian - /// PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian - /// QST Number (Québec) | | Chile | `cl_tin` | Chilean - /// TIN | | China | `cn_tin` | Chinese - /// Tax ID | | Colombia | `co_nit` | Colombian - /// NIT Number | | Costa Rica | `cr_tin` | Costa - /// Rican Tax ID | | Croatia | `eu_vat` | European - /// VAT Number | | Cyprus | `eu_vat` | European - /// VAT Number | | Czech Republic | `eu_vat` | European - /// VAT Number | | Denmark | `eu_vat` | European - /// VAT Number | | Dominican Republic | `do_rcn` | Dominican - /// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian - /// RUC Number | | Egypt | `eg_tin` | Egyptian - /// Tax Identification Number | | El Salvador | `sv_nit` - /// | El Salvadorian NIT Number | | Estonia | `eu_vat` | - /// European VAT Number | | EU | `eu_oss_vat` | European One Stop Shop - /// VAT Number for non-Union scheme | | Finland | `eu_vat` | European VAT - /// Number | | France | `eu_vat` | European - /// VAT Number | | Georgia | `ge_vat` | - /// Georgian VAT | | Germany | `eu_vat` - /// | European VAT Number | | Greece - /// | `eu_vat` | European VAT Number | | - /// Hong Kong | `hk_br` | Hong Kong BR Number - /// | | Hungary | `eu_vat` | European VAT Number - /// | | Hungary | `hu_tin` | Hungary Tax Number (adószám) - /// | | Iceland | `is_vat` | Icelandic VAT - /// | | India | `in_gst` | Indian GST - /// Number | | Indonesia | `id_npwp` | Indonesian - /// NPWP Number | | Ireland | `eu_vat` | - /// European VAT Number | | Israel | `il_vat` - /// | Israel VAT | | Italy - /// | `eu_vat` | European VAT Number | | - /// Japan | `jp_cn` | Japanese Corporate Number (*Hōjin Bangō*) - /// | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' - /// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | - /// Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) - /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification - /// Number | | Kenya | `ke_pin` | Kenya Revenue Authority - /// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number - /// | | Liechtenstein | `li_uid` | Liechtensteinian - /// UID Number | | Lithuania | `eu_vat` | European VAT Number - /// | | Luxembourg | `eu_vat` | European VAT Number - /// | | Malaysia | `my_frp` | Malaysian FRP Number - /// | | Malaysia | `my_itn` | Malaysian ITN - /// | | Malaysia | `my_sst` | Malaysian SST Number | - /// | Malta | `eu_vat ` | European VAT Number | | Mexico - /// | `mx_rfc` | Mexican RFC Number | | Netherlands - /// | `eu_vat` | European VAT Number | | New Zealand | - /// `nz_gst` | New Zealand GST Number | | Nigeria | - /// `ng_tin` | Nigerian Tax Identification Number | | Norway | `no_vat` - /// | Norwegian VAT Number | | Norway | `no_voec` | Norwegian - /// VAT on e-commerce Number | | Oman | `om_vat` | Omani VAT Number - /// | | Peru | `pe_ruc` | Peruvian RUC Number - /// | | Philippines | `ph_tin ` | Philippines Tax Identification - /// Number | | Poland | `eu_vat` | European VAT Number - /// | | Portugal | `eu_vat` | European VAT Number | | - /// Romania | `eu_vat` | European VAT Number | | Romania - /// | `ro_tin` | Romanian Tax ID Number | | Russia - /// | `ru_inn` | Russian INN | | Russia | `ru_kpp` - /// | Russian KPP | | Saudi Arabia | `sa_vat` | Saudi - /// Arabia VAT | | Serbia | `rs_pib` | Serbian PIB - /// Number | | Singapore | `sg_gst` | Singaporean GST - /// | | Singapore | `sg_uen` | Singaporean UEN - /// | | Slovakia | `eu_vat` | European VAT Number - /// | | Slovenia | `eu_vat` | European VAT Number - /// | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) - /// | | South Africa | `za_vat` | South African VAT - /// Number | | South Korea | `kr_brn` | Korean - /// BRN | | Spain | `es_cif` - /// | Spanish NIF Number (previously Spanish CIF Number) | | Spain - /// | `eu_vat` | European VAT Number | | - /// Sweden | `eu_vat` | European VAT Number - /// | | Switzerland | `ch_vat` | Switzerland VAT Number - /// | | Taiwan | `tw_vat` | Taiwanese VAT - /// | | Thailand | `th_vat` | - /// Thai VAT | | Turkey - /// | `tr_tin` | Turkish Tax Identification Number | | Ukraine - /// | `ua_vat` | Ukrainian VAT - /// | | United Arab Emirates | `ae_trn` | United Arab Emirates TRN - /// | | United Kingdom | `eu_vat` | Northern Ireland - /// VAT Number | | United Kingdom | `gb_vat` | United - /// Kingdom VAT Number | | United States | `us_ein` - /// | United States EIN | | Uruguay - /// | `uy_ruc` | Uruguayan RUC Number | | Venezuela - /// | `ve_rif` | Venezuelan RIF Number - /// | | Vietnam | `vn_tin` | Vietnamese Tax ID Number - /// | + /// | Country | Type | Description | |---------|------|-------------| | Albania + /// | `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran + /// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina + /// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax + /// Identification Number | | Aruba | `aw_tin` | Aruba Tax Identification Number + /// | | Australia | `au_abn` | Australian Business Number (AU ABN) | | Australia + /// | `au_arn` | Australian Taxation Office Reference Number | | Austria | `eu_vat` + /// | European VAT Number | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification + /// Number | | Bahamas | `bs_tin` | Bahamas Tax Identification Number | | Bahrain + /// | `bh_vat` | Bahraini VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business + /// Identification Number | | Barbados | `bb_tin` | Barbados Tax Identification + /// Number | | Belarus | `by_tin` | Belarus TIN Number | | Belgium | `eu_vat` | + /// European VAT Number | | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant + /// Fiscal Unique) | | Bolivia | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina + /// | `ba_tin` | Bosnia and Herzegovina Tax Identification Number | | Brazil | `br_cnpj` + /// | Brazilian CNPJ Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria + /// | `bg_uic` | Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | + /// European VAT Number | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification + /// Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia + /// Tax Identification Number | | Cameroon | `cm_niu` | Cameroon Tax Identification + /// Number (Numéro d'Identifiant fiscal Unique) | | Canada | `ca_bn` | Canadian + /// BN | | Canada | `ca_gst_hst` | Canadian GST/HST Number | | Canada | `ca_pst_bc` + /// | Canadian PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian + /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) + /// | | Canada | `ca_qst` | Canadian QST Number (Québec) | | Cape Verde | `cv_nif` + /// | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | + /// Chile | `cl_tin` | Chilean TIN | | China | `cn_tin` | Chinese Tax ID | | Colombia + /// | `co_nit` | Colombian NIT Number | | Congo-Kinshasa | `cd_nif` | Congo (DR) + /// Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | + /// `cr_tin` | Costa Rican Tax ID | | Croatia | `eu_vat` | European VAT Number | + /// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) | | Cyprus + /// | `eu_vat` | European VAT Number | | Czech Republic | `eu_vat` | European VAT + /// Number | | Denmark | `eu_vat` | European VAT Number | | Dominican Republic + /// | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` | Ecuadorian RUC Number + /// | | Egypt | `eg_tin` | Egyptian Tax Identification Number | | El Salvador | + /// `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` | European VAT + /// Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number | | European + /// Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme + /// | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European + /// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German + /// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | + /// Greece | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification + /// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong + /// BR Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` + /// | Hungary Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India + /// | `in_gst` | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP + /// Number | | Ireland | `eu_vat` | European VAT Number | | Israel | `il_vat` | + /// Israel VAT | | Italy | `eu_vat` | European VAT Number | | Japan | `jp_cn` | + /// Japanese Corporate Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered + /// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku + /// Bangō*) | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) + /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number | | + /// Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + /// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number | | Laos | `la_tin` + /// | Laos Tax Identification Number | | Latvia | `eu_vat` | European VAT Number + /// | | Liechtenstein | `li_uid` | Liechtensteinian UID Number | | Liechtenstein + /// | `li_vat` | Liechtenstein VAT Number | | Lithuania | `eu_vat` | European VAT + /// Number | | Luxembourg | `eu_vat` | European VAT Number | | Malaysia | `my_frp` + /// | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian ITN | | Malaysia + /// | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European VAT Number + /// | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de + /// Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova + /// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB + /// Number | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal + /// PAN Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand + /// | `nz_gst` | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification + /// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern + /// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian + /// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman + /// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | + /// Philippines | `ph_tin` | Philippines Tax Identification Number | | Poland | + /// `eu_vat` | European VAT Number | | Portugal | `eu_vat` | European VAT Number + /// | | Romania | `eu_vat` | European VAT Number | | Romania | `ro_tin` | Romanian + /// Tax ID Number | | Russia | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian + /// KPP | | Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` + /// | Senegal NINEA Number | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore + /// | `sg_gst` | Singaporean GST | | Singapore | `sg_uen` | Singaporean UEN | | + /// Slovakia | `eu_vat` | European VAT Number | | Slovenia | `eu_vat` | European + /// VAT Number | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) | + /// | South Africa | `za_vat` | South African VAT Number | | South Korea | `kr_brn` + /// | Korean BRN | | Spain | `es_cif` | Spanish NIF Number (previously Spanish + /// CIF Number) | | Spain | `eu_vat` | European VAT Number | | Suriname | `sr_fin` + /// | Suriname FIN Number | | Sweden | `eu_vat` | European VAT Number | | Switzerland + /// | `ch_uid` | Switzerland UID Number | | Switzerland | `ch_vat` | Switzerland + /// VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | Tajikistan | `tj_tin` + /// | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` | Tanzania VAT + /// Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` | Turkish Tax + /// Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification Number + /// | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` | + /// United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT + /// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` + /// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | + /// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | + /// Venezuelan RIF Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | + /// Zambia | `zm_tin` | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` + /// | Zimbabwe Tax Identification Number | /// - public Models::CustomerTaxID? TaxID + public CustomerTaxID? TaxID { get { - if (!this.BodyProperties.TryGetValue("tax_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("tax_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["tax_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["tax_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -467,15 +407,15 @@ public string? Timezone { get { - if (!this.BodyProperties.TryGetValue("timezone", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timezone", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["timezone"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["timezone"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/customers") { @@ -483,21 +423,21 @@ public string? Timezone }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerCreateParamsProperties/PaymentProvider.cs b/src/Orb/Models/Customers/CustomerCreateParamsProperties/PaymentProvider.cs index 7e6e7a69..4495c0d2 100644 --- a/src/Orb/Models/Customers/CustomerCreateParamsProperties/PaymentProvider.cs +++ b/src/Orb/Models/Customers/CustomerCreateParamsProperties/PaymentProvider.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerCreateParamsProperties; @@ -8,8 +7,8 @@ namespace Orb.Models.Customers.CustomerCreateParamsProperties; /// This is used for creating charges or invoices in an external system via Orb. When /// not in test mode, the connection must first be configured in the Orb webapp. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PaymentProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PaymentProvider(string value) : IEnum { public static readonly PaymentProvider Quickbooks = new("quickbooks"); @@ -40,7 +39,7 @@ public Value Known() => "stripe_charge" => Value.StripeCharge, "stripe_invoice" => Value.StripeInvoice, "netsuite" => Value.Netsuite, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfiguration.cs b/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfiguration.cs index 33ced7ec..874b68df 100644 --- a/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfiguration.cs +++ b/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfiguration.cs @@ -1,26 +1,21 @@ -using Customers = Orb.Models.Customers; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using TaxConfigurationVariants = Orb.Models.Customers.CustomerCreateParamsProperties.TaxConfigurationVariants; namespace Orb.Models.Customers.CustomerCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class TaxConfiguration { internal TaxConfiguration() { } - public static TaxConfigurationVariants::NewAvalaraTaxConfiguration Create( - Customers::NewAvalaraTaxConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewAvalaraTaxConfiguration value) => + new TaxConfigurationVariants::NewAvalaraTaxConfigurationVariant(value); - public static TaxConfigurationVariants::NewTaxJarConfiguration Create( - Customers::NewTaxJarConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewTaxJarConfiguration value) => + new TaxConfigurationVariants::NewTaxJarConfigurationVariant(value); - public static TaxConfigurationVariants::NewSphereConfiguration Create( - Customers::NewSphereConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewSphereConfiguration value) => + new TaxConfigurationVariants::NewSphereConfigurationVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfigurationVariants/All.cs b/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfigurationVariants/All.cs index ff7e8088..bbdc6411 100644 --- a/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfigurationVariants/All.cs +++ b/src/Orb/Models/Customers/CustomerCreateParamsProperties/TaxConfigurationVariants/All.cs @@ -1,18 +1,15 @@ -using CustomerCreateParamsProperties = Orb.Models.Customers.CustomerCreateParamsProperties; -using Customers = Orb.Models.Customers; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerCreateParamsProperties.TaxConfigurationVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewAvalaraTaxConfiguration(Customers::NewAvalaraTaxConfiguration Value) - : CustomerCreateParamsProperties::TaxConfiguration, - Orb::IVariant +public sealed record class NewAvalaraTaxConfigurationVariant(NewAvalaraTaxConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewAvalaraTaxConfiguration From(Customers::NewAvalaraTaxConfiguration value) + public static NewAvalaraTaxConfigurationVariant From(NewAvalaraTaxConfiguration value) { return new(value); } @@ -23,14 +20,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewTaxJarConfiguration(Customers::NewTaxJarConfiguration Value) - : CustomerCreateParamsProperties::TaxConfiguration, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewTaxJarConfigurationVariant(NewTaxJarConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewTaxJarConfiguration From(Customers::NewTaxJarConfiguration value) + public static NewTaxJarConfigurationVariant From(NewTaxJarConfiguration value) { return new(value); } @@ -41,14 +36,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSphereConfiguration(Customers::NewSphereConfiguration Value) - : CustomerCreateParamsProperties::TaxConfiguration, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSphereConfigurationVariant(NewSphereConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewSphereConfiguration From(Customers::NewSphereConfiguration value) + public static NewSphereConfigurationVariant From(NewSphereConfiguration value) { return new(value); } diff --git a/src/Orb/Models/Customers/CustomerDeleteParams.cs b/src/Orb/Models/Customers/CustomerDeleteParams.cs index 56b42569..2dac5a4c 100644 --- a/src/Orb/Models/Customers/CustomerDeleteParams.cs +++ b/src/Orb/Models/Customers/CustomerDeleteParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Customers; @@ -16,11 +15,11 @@ namespace Orb.Models.Customers; /// few minutes to propagate to related resources. However, querying for the customer /// on subsequent GET requests while deletion is in process will reflect its deletion. /// -public sealed record class CustomerDeleteParams : Orb::ParamsBase +public sealed record class CustomerDeleteParams : ParamsBase { public required string CustomerID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -31,12 +30,12 @@ public sealed record class CustomerDeleteParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerFetchByExternalIDParams.cs b/src/Orb/Models/Customers/CustomerFetchByExternalIDParams.cs index db986392..ca9f9604 100644 --- a/src/Orb/Models/Customers/CustomerFetchByExternalIDParams.cs +++ b/src/Orb/Models/Customers/CustomerFetchByExternalIDParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Customers; @@ -10,11 +9,11 @@ namespace Orb.Models.Customers; /// /// Note that the resource and semantics of this endpoint exactly mirror [Get Customer](fetch-customer). /// -public sealed record class CustomerFetchByExternalIDParams : Orb::ParamsBase +public sealed record class CustomerFetchByExternalIDParams : ParamsBase { public required string ExternalCustomerID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -25,12 +24,12 @@ public sealed record class CustomerFetchByExternalIDParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerFetchParams.cs b/src/Orb/Models/Customers/CustomerFetchParams.cs index 10c1d631..14f95913 100644 --- a/src/Orb/Models/Customers/CustomerFetchParams.cs +++ b/src/Orb/Models/Customers/CustomerFetchParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Customers; @@ -12,11 +11,11 @@ namespace Orb.Models.Customers; /// See the [Customer resource](/core-concepts#customer) for a full discussion of /// the Customer model. /// -public sealed record class CustomerFetchParams : Orb::ParamsBase +public sealed record class CustomerFetchParams : ParamsBase { public required string CustomerID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -27,12 +26,12 @@ public sealed record class CustomerFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerHierarchyConfig.cs b/src/Orb/Models/Customers/CustomerHierarchyConfig.cs index a35c9011..133df819 100644 --- a/src/Orb/Models/Customers/CustomerHierarchyConfig.cs +++ b/src/Orb/Models/Customers/CustomerHierarchyConfig.cs @@ -1,33 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CustomerHierarchyConfig - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CustomerHierarchyConfig : ModelBase, IFromRaw { /// /// A list of child customer IDs to add to the hierarchy. The desired child customers /// must not already be part of another hierarchy. /// - public Generic::List? ChildCustomerIDs + public List? ChildCustomerIDs { get { - if (!this.Properties.TryGetValue("child_customer_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("child_customer_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["child_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["child_customer_ids"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,15 +32,12 @@ public string? ParentCustomerID { get { - if (!this.Properties.TryGetValue("parent_customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("parent_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["parent_customer_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["parent_customer_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -61,15 +52,15 @@ public override void Validate() public CustomerHierarchyConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomerHierarchyConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomerHierarchyConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CustomerHierarchyConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/CustomerListPageResponse.cs b/src/Orb/Models/Customers/CustomerListPageResponse.cs index 38693296..cb0f6395 100644 --- a/src/Orb/Models/Customers/CustomerListPageResponse.cs +++ b/src/Orb/Models/Customers/CustomerListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CustomerListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CustomerListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,15 +51,15 @@ public override void Validate() public CustomerListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomerListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomerListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CustomerListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/CustomerListParams.cs b/src/Orb/Models/Customers/CustomerListParams.cs index 78514230..1a667fab 100644 --- a/src/Orb/Models/Customers/CustomerListParams.cs +++ b/src/Orb/Models/Customers/CustomerListParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Customers; @@ -12,70 +11,54 @@ namespace Orb.Models.Customers; /// /// See [Customer](/core-concepts##customer) for an overview of the customer model. /// -public sealed record class CustomerListParams : Orb::ParamsBase +public sealed record class CustomerListParams : ParamsBase { public System::DateTime? CreatedAtGt { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -86,12 +69,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,15 +84,15 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/customers") { @@ -117,12 +100,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfiguration.cs b/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfiguration.cs index 132438bd..a4139d5d 100644 --- a/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfiguration.cs +++ b/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfiguration.cs @@ -1,53 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AccountingSyncConfigurationProperties = Orb.Models.Customers.CustomerProperties.AccountingSyncConfigurationProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Customers.CustomerProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class AccountingSyncConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List AccountingProviders + public required List AccountingProviders { get { - if (!this.Properties.TryGetValue("accounting_providers", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("accounting_providers", out JsonElement element)) + throw new ArgumentOutOfRangeException( "accounting_providers", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("accounting_providers"); - } - set - { - this.Properties["accounting_providers"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new ArgumentNullException("accounting_providers"); } + set { this.Properties["accounting_providers"] = JsonSerializer.SerializeToElement(value); } } public required bool Excluded { get { - if (!this.Properties.TryGetValue("excluded", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "excluded", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("excluded", out JsonElement element)) + throw new ArgumentOutOfRangeException("excluded", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["excluded"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["excluded"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -62,15 +53,15 @@ public override void Validate() public AccountingSyncConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AccountingSyncConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + AccountingSyncConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static AccountingSyncConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProvider.cs b/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProvider.cs index 8b0906fc..a6f44360 100644 --- a/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProvider.cs +++ b/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProvider.cs @@ -1,51 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AccountingProviderProperties = Orb.Models.Customers.CustomerProperties.AccountingSyncConfigurationProperties.AccountingProviderProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Customers.CustomerProperties.AccountingSyncConfigurationProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AccountingProvider : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AccountingProvider : ModelBase, IFromRaw { public required string? ExternalProviderID { get { - if (!this.Properties.TryGetValue("external_provider_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_provider_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_provider_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_provider_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_provider_id"] = JsonSerializer.SerializeToElement(value); } } public required AccountingProviderProperties::ProviderType ProviderType { get { - if (!this.Properties.TryGetValue("provider_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "provider_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("provider_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("provider_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("provider_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("provider_type"); } - set { this.Properties["provider_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["provider_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +47,14 @@ public override void Validate() public AccountingProvider() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AccountingProvider(Generic::Dictionary properties) + [SetsRequiredMembers] + AccountingProvider(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AccountingProvider FromRawUnchecked( - Generic::Dictionary properties - ) + public static AccountingProvider FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProviderProperties/ProviderType.cs b/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProviderProperties/ProviderType.cs index ada5c6c0..608842db 100644 --- a/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProviderProperties/ProviderType.cs +++ b/src/Orb/Models/Customers/CustomerProperties/AccountingSyncConfigurationProperties/AccountingProviderProperties/ProviderType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerProperties.AccountingSyncConfigurationProperties.AccountingProviderProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ProviderType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ProviderType(string value) : IEnum { public static readonly ProviderType Quickbooks = new("quickbooks"); @@ -24,7 +23,7 @@ public Value Known() => { "quickbooks" => Value.Quickbooks, "netsuite" => Value.Netsuite, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/CustomerProperties/Hierarchy.cs b/src/Orb/Models/Customers/CustomerProperties/Hierarchy.cs index e148765b..d7f44f27 100644 --- a/src/Orb/Models/Customers/CustomerProperties/Hierarchy.cs +++ b/src/Orb/Models/Customers/CustomerProperties/Hierarchy.cs @@ -1,49 +1,40 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerProperties; /// /// The hierarchical relationships for this customer. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Hierarchy : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Hierarchy : ModelBase, IFromRaw { - public required Generic::List Children + public required List Children { get { - if (!this.Properties.TryGetValue("children", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "children", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("children", out JsonElement element)) + throw new ArgumentOutOfRangeException("children", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("children"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("children"); } - set { this.Properties["children"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["children"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CustomerMinified? Parent + public required CustomerMinified? Parent { get { - if (!this.Properties.TryGetValue("parent", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "parent", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("parent", out JsonElement element)) + throw new ArgumentOutOfRangeException("parent", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["parent"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["parent"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -58,16 +49,14 @@ public override void Validate() public Hierarchy() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Hierarchy(Generic::Dictionary properties) + [SetsRequiredMembers] + Hierarchy(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Hierarchy FromRawUnchecked( - Generic::Dictionary properties - ) + public static Hierarchy FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Customers/CustomerProperties/PaymentProvider.cs b/src/Orb/Models/Customers/CustomerProperties/PaymentProvider.cs index 77d0811a..cea31b22 100644 --- a/src/Orb/Models/Customers/CustomerProperties/PaymentProvider.cs +++ b/src/Orb/Models/Customers/CustomerProperties/PaymentProvider.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerProperties; @@ -8,8 +7,8 @@ namespace Orb.Models.Customers.CustomerProperties; /// This is used for creating charges or invoices in an external system via Orb. When /// not in test mode, the connection must first be configured in the Orb webapp. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PaymentProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PaymentProvider(string value) : IEnum { public static readonly PaymentProvider Quickbooks = new("quickbooks"); @@ -40,7 +39,7 @@ public Value Known() => "stripe_charge" => Value.StripeCharge, "stripe_invoice" => Value.StripeInvoice, "netsuite" => Value.Netsuite, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/CustomerProperties/ReportingConfiguration.cs b/src/Orb/Models/Customers/CustomerProperties/ReportingConfiguration.cs index 2ec67714..8ea81317 100644 --- a/src/Orb/Models/Customers/CustomerProperties/ReportingConfiguration.cs +++ b/src/Orb/Models/Customers/CustomerProperties/ReportingConfiguration.cs @@ -1,30 +1,24 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReportingConfiguration - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReportingConfiguration : ModelBase, IFromRaw { public required bool Exempt { get { - if (!this.Properties.TryGetValue("exempt", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "exempt", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("exempt", out JsonElement element)) + throw new ArgumentOutOfRangeException("exempt", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["exempt"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["exempt"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -35,15 +29,15 @@ public override void Validate() public ReportingConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReportingConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + ReportingConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ReportingConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams.cs b/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams.cs index d27f8568..6819d54b 100644 --- a/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams.cs +++ b/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Customers; @@ -13,11 +12,11 @@ namespace Orb.Models.Customers; /// **Note**: This functionality is currently only available for Stripe. /// public sealed record class CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams - : Orb::ParamsBase + : ParamsBase { public required string ExternalCustomerID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -31,12 +30,12 @@ public sealed record class CustomerSyncPaymentMethodsFromGatewayByExternalCustom }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayParams.cs b/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayParams.cs index 030990f0..21158c2f 100644 --- a/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayParams.cs +++ b/src/Orb/Models/Customers/CustomerSyncPaymentMethodsFromGatewayParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Customers; @@ -12,11 +11,11 @@ namespace Orb.Models.Customers; /// /// **Note**: This functionality is currently only available for Stripe. /// -public sealed record class CustomerSyncPaymentMethodsFromGatewayParams : Orb::ParamsBase +public sealed record class CustomerSyncPaymentMethodsFromGatewayParams : ParamsBase { public required string CustomerID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -27,12 +26,12 @@ public sealed record class CustomerSyncPaymentMethodsFromGatewayParams : Orb::Pa }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParams.cs b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParams.cs index ab7c4766..9c8144e0 100644 --- a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParams.cs +++ b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParams.cs @@ -1,11 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using CustomerUpdateByExternalIDParamsProperties = Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Customers; @@ -14,9 +12,9 @@ namespace Orb.Models.Customers; /// (see [Customer ID Aliases](/events-and-metrics/customer-aliases)). Note that /// the resource and semantics of this endpoint exactly mirror [Update Customer](update-customer). /// -public sealed record class CustomerUpdateByExternalIDParams : Orb::ParamsBase +public sealed record class CustomerUpdateByExternalIDParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ID; @@ -27,17 +25,17 @@ public NewAccountingSyncConfiguration? AccountingSyncConfiguration if ( !this.BodyProperties.TryGetValue( "accounting_sync_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["accounting_sync_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -45,23 +43,16 @@ public NewAccountingSyncConfiguration? AccountingSyncConfiguration /// Additional email addresses for this customer. If populated, these email addresses /// will be CC'd for customer communications. /// - public Generic::List? AdditionalEmails + public List? AdditionalEmails { get { - if ( - !this.BodyProperties.TryGetValue("additional_emails", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("additional_emails", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.BodyProperties["additional_emails"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.BodyProperties["additional_emails"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,30 +64,24 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("auto_collection", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public AddressInput? BillingAddress { get { - if (!this.BodyProperties.TryGetValue("billing_address", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("billing_address", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["billing_address"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["billing_address"] = JsonSerializer.SerializeToElement(value); } } /// @@ -107,12 +92,12 @@ public string? Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,52 +107,44 @@ public string? Email { get { - if (!this.BodyProperties.TryGetValue("email", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("email", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["email"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["email"] = JsonSerializer.SerializeToElement(value); } } public bool? EmailDelivery { get { - if (!this.BodyProperties.TryGetValue("email_delivery", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("email_delivery", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["email_delivery"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["email_delivery"] = JsonSerializer.SerializeToElement(value); } } /// - /// The external customer ID. This can only be set if empty and the customer has - /// no past or current subscriptions. + /// The external customer ID. This can only be set if the customer has no existing + /// external customer ID. Since this action may change usage quantities for all + /// existing subscriptions, it is disallowed if the customer has issued invoices + /// with usage line items and subject to the same restrictions as backdated subscription creation. /// public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -178,12 +155,12 @@ public CustomerHierarchyConfig? Hierarchy { get { - if (!this.BodyProperties.TryGetValue("hierarchy", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("hierarchy", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["hierarchy"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["hierarchy"] = JsonSerializer.SerializeToElement(value); } } /// @@ -191,16 +168,16 @@ public CustomerHierarchyConfig? Hierarchy /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -210,12 +187,12 @@ public string? Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -229,19 +206,14 @@ public string? Name { get { - if (!this.BodyProperties.TryGetValue("payment_provider", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("payment_provider", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["payment_provider"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["payment_provider"] = JsonSerializer.SerializeToElement(value); } } /// @@ -252,21 +224,14 @@ public string? PaymentProviderID { get { - if ( - !this.BodyProperties.TryGetValue( - "payment_provider_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("payment_provider_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["payment_provider_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["payment_provider_id"] = JsonSerializer.SerializeToElement(value); } } @@ -275,19 +240,17 @@ public NewReportingConfiguration? ReportingConfiguration get { if ( - !this.BodyProperties.TryGetValue( - "reporting_configuration", - out Json::JsonElement element - ) + !this.BodyProperties.TryGetValue("reporting_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["reporting_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["reporting_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -295,38 +258,26 @@ public AddressInput? ShippingAddress { get { - if (!this.BodyProperties.TryGetValue("shipping_address", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("shipping_address", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["shipping_address"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["shipping_address"] = JsonSerializer.SerializeToElement(value); } } public CustomerUpdateByExternalIDParamsProperties::TaxConfiguration? TaxConfiguration { get { - if ( - !this.BodyProperties.TryGetValue("tax_configuration", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("tax_configuration", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["tax_configuration"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["tax_configuration"] = JsonSerializer.SerializeToElement(value); } } /// @@ -335,125 +286,116 @@ public AddressInput? ShippingAddress /// /// ### Supported Tax ID Countries and Types /// - /// | Country | Type | Description - /// | |----------------|--------------|---------------------------------------------| - /// | Andorra | `ad_nrt` | Andorran NRT Number - /// | | Argentina | `ar_cuit` | Argentinian Tax ID Number - /// | | Australia | `au_abn` | Australian Business Number (AU ABN) - /// | | Australia | `au_arn` | Australian Taxation Office - /// Reference Number | | Austria | `eu_vat` | European VAT Number - /// | | Bahrain | `bh_vat` | Bahraini VAT Number - /// | | Belgium | `eu_vat` | European VAT Number - /// | | Bolivia | `bo_tin` | Bolivian Tax ID - /// | | Brazil | `br_cnpj` | Brazilian CNPJ - /// Number | | Brazil | `br_cpf` | Brazilian CPF - /// Number | | Bulgaria | `bg_uic` | Bulgaria - /// Unified Identification Code | | Bulgaria | `eu_vat` | European - /// VAT Number | | Canada | `ca_bn` | Canadian - /// BN | | Canada | `ca_gst_hst` | Canadian - /// GST/HST Number | | Canada | `ca_pst_bc` | Canadian - /// PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian - /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian - /// PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian - /// QST Number (Québec) | | Chile | `cl_tin` | Chilean - /// TIN | | China | `cn_tin` | Chinese - /// Tax ID | | Colombia | `co_nit` | Colombian - /// NIT Number | | Costa Rica | `cr_tin` | Costa - /// Rican Tax ID | | Croatia | `eu_vat` | European - /// VAT Number | | Cyprus | `eu_vat` | European - /// VAT Number | | Czech Republic | `eu_vat` | European - /// VAT Number | | Denmark | `eu_vat` | European - /// VAT Number | | Dominican Republic | `do_rcn` | Dominican - /// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian - /// RUC Number | | Egypt | `eg_tin` | Egyptian - /// Tax Identification Number | | El Salvador | `sv_nit` - /// | El Salvadorian NIT Number | | Estonia | `eu_vat` | - /// European VAT Number | | EU | `eu_oss_vat` | European One Stop Shop - /// VAT Number for non-Union scheme | | Finland | `eu_vat` | European VAT - /// Number | | France | `eu_vat` | European - /// VAT Number | | Georgia | `ge_vat` | - /// Georgian VAT | | Germany | `eu_vat` - /// | European VAT Number | | Greece - /// | `eu_vat` | European VAT Number | | - /// Hong Kong | `hk_br` | Hong Kong BR Number - /// | | Hungary | `eu_vat` | European VAT Number - /// | | Hungary | `hu_tin` | Hungary Tax Number (adószám) - /// | | Iceland | `is_vat` | Icelandic VAT - /// | | India | `in_gst` | Indian GST - /// Number | | Indonesia | `id_npwp` | Indonesian - /// NPWP Number | | Ireland | `eu_vat` | - /// European VAT Number | | Israel | `il_vat` - /// | Israel VAT | | Italy - /// | `eu_vat` | European VAT Number | | - /// Japan | `jp_cn` | Japanese Corporate Number (*Hōjin Bangō*) - /// | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' - /// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | - /// Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) - /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification - /// Number | | Kenya | `ke_pin` | Kenya Revenue Authority - /// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number - /// | | Liechtenstein | `li_uid` | Liechtensteinian - /// UID Number | | Lithuania | `eu_vat` | European VAT Number - /// | | Luxembourg | `eu_vat` | European VAT Number - /// | | Malaysia | `my_frp` | Malaysian FRP Number - /// | | Malaysia | `my_itn` | Malaysian ITN - /// | | Malaysia | `my_sst` | Malaysian SST Number | - /// | Malta | `eu_vat ` | European VAT Number | | Mexico - /// | `mx_rfc` | Mexican RFC Number | | Netherlands - /// | `eu_vat` | European VAT Number | | New Zealand | - /// `nz_gst` | New Zealand GST Number | | Nigeria | - /// `ng_tin` | Nigerian Tax Identification Number | | Norway | `no_vat` - /// | Norwegian VAT Number | | Norway | `no_voec` | Norwegian - /// VAT on e-commerce Number | | Oman | `om_vat` | Omani VAT Number - /// | | Peru | `pe_ruc` | Peruvian RUC Number - /// | | Philippines | `ph_tin ` | Philippines Tax Identification - /// Number | | Poland | `eu_vat` | European VAT Number - /// | | Portugal | `eu_vat` | European VAT Number | | - /// Romania | `eu_vat` | European VAT Number | | Romania - /// | `ro_tin` | Romanian Tax ID Number | | Russia - /// | `ru_inn` | Russian INN | | Russia | `ru_kpp` - /// | Russian KPP | | Saudi Arabia | `sa_vat` | Saudi - /// Arabia VAT | | Serbia | `rs_pib` | Serbian PIB - /// Number | | Singapore | `sg_gst` | Singaporean GST - /// | | Singapore | `sg_uen` | Singaporean UEN - /// | | Slovakia | `eu_vat` | European VAT Number - /// | | Slovenia | `eu_vat` | European VAT Number - /// | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) - /// | | South Africa | `za_vat` | South African VAT - /// Number | | South Korea | `kr_brn` | Korean - /// BRN | | Spain | `es_cif` - /// | Spanish NIF Number (previously Spanish CIF Number) | | Spain - /// | `eu_vat` | European VAT Number | | - /// Sweden | `eu_vat` | European VAT Number - /// | | Switzerland | `ch_vat` | Switzerland VAT Number - /// | | Taiwan | `tw_vat` | Taiwanese VAT - /// | | Thailand | `th_vat` | - /// Thai VAT | | Turkey - /// | `tr_tin` | Turkish Tax Identification Number | | Ukraine - /// | `ua_vat` | Ukrainian VAT - /// | | United Arab Emirates | `ae_trn` | United Arab Emirates TRN - /// | | United Kingdom | `eu_vat` | Northern Ireland - /// VAT Number | | United Kingdom | `gb_vat` | United - /// Kingdom VAT Number | | United States | `us_ein` - /// | United States EIN | | Uruguay - /// | `uy_ruc` | Uruguayan RUC Number | | Venezuela - /// | `ve_rif` | Venezuelan RIF Number - /// | | Vietnam | `vn_tin` | Vietnamese Tax ID Number - /// | + /// | Country | Type | Description | |---------|------|-------------| | Albania + /// | `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran + /// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina + /// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax + /// Identification Number | | Aruba | `aw_tin` | Aruba Tax Identification Number + /// | | Australia | `au_abn` | Australian Business Number (AU ABN) | | Australia + /// | `au_arn` | Australian Taxation Office Reference Number | | Austria | `eu_vat` + /// | European VAT Number | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification + /// Number | | Bahamas | `bs_tin` | Bahamas Tax Identification Number | | Bahrain + /// | `bh_vat` | Bahraini VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business + /// Identification Number | | Barbados | `bb_tin` | Barbados Tax Identification + /// Number | | Belarus | `by_tin` | Belarus TIN Number | | Belgium | `eu_vat` | + /// European VAT Number | | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant + /// Fiscal Unique) | | Bolivia | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina + /// | `ba_tin` | Bosnia and Herzegovina Tax Identification Number | | Brazil | `br_cnpj` + /// | Brazilian CNPJ Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria + /// | `bg_uic` | Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | + /// European VAT Number | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification + /// Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia + /// Tax Identification Number | | Cameroon | `cm_niu` | Cameroon Tax Identification + /// Number (Numéro d'Identifiant fiscal Unique) | | Canada | `ca_bn` | Canadian + /// BN | | Canada | `ca_gst_hst` | Canadian GST/HST Number | | Canada | `ca_pst_bc` + /// | Canadian PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian + /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) + /// | | Canada | `ca_qst` | Canadian QST Number (Québec) | | Cape Verde | `cv_nif` + /// | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | + /// Chile | `cl_tin` | Chilean TIN | | China | `cn_tin` | Chinese Tax ID | | Colombia + /// | `co_nit` | Colombian NIT Number | | Congo-Kinshasa | `cd_nif` | Congo (DR) + /// Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | + /// `cr_tin` | Costa Rican Tax ID | | Croatia | `eu_vat` | European VAT Number | + /// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) | | Cyprus + /// | `eu_vat` | European VAT Number | | Czech Republic | `eu_vat` | European VAT + /// Number | | Denmark | `eu_vat` | European VAT Number | | Dominican Republic + /// | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` | Ecuadorian RUC Number + /// | | Egypt | `eg_tin` | Egyptian Tax Identification Number | | El Salvador | + /// `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` | European VAT + /// Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number | | European + /// Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme + /// | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European + /// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German + /// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | + /// Greece | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification + /// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong + /// BR Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` + /// | Hungary Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India + /// | `in_gst` | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP + /// Number | | Ireland | `eu_vat` | European VAT Number | | Israel | `il_vat` | + /// Israel VAT | | Italy | `eu_vat` | European VAT Number | | Japan | `jp_cn` | + /// Japanese Corporate Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered + /// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku + /// Bangō*) | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) + /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number | | + /// Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + /// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number | | Laos | `la_tin` + /// | Laos Tax Identification Number | | Latvia | `eu_vat` | European VAT Number + /// | | Liechtenstein | `li_uid` | Liechtensteinian UID Number | | Liechtenstein + /// | `li_vat` | Liechtenstein VAT Number | | Lithuania | `eu_vat` | European VAT + /// Number | | Luxembourg | `eu_vat` | European VAT Number | | Malaysia | `my_frp` + /// | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian ITN | | Malaysia + /// | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European VAT Number + /// | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de + /// Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova + /// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB + /// Number | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal + /// PAN Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand + /// | `nz_gst` | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification + /// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern + /// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian + /// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman + /// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | + /// Philippines | `ph_tin` | Philippines Tax Identification Number | | Poland | + /// `eu_vat` | European VAT Number | | Portugal | `eu_vat` | European VAT Number + /// | | Romania | `eu_vat` | European VAT Number | | Romania | `ro_tin` | Romanian + /// Tax ID Number | | Russia | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian + /// KPP | | Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` + /// | Senegal NINEA Number | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore + /// | `sg_gst` | Singaporean GST | | Singapore | `sg_uen` | Singaporean UEN | | + /// Slovakia | `eu_vat` | European VAT Number | | Slovenia | `eu_vat` | European + /// VAT Number | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) | + /// | South Africa | `za_vat` | South African VAT Number | | South Korea | `kr_brn` + /// | Korean BRN | | Spain | `es_cif` | Spanish NIF Number (previously Spanish + /// CIF Number) | | Spain | `eu_vat` | European VAT Number | | Suriname | `sr_fin` + /// | Suriname FIN Number | | Sweden | `eu_vat` | European VAT Number | | Switzerland + /// | `ch_uid` | Switzerland UID Number | | Switzerland | `ch_vat` | Switzerland + /// VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | Tajikistan | `tj_tin` + /// | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` | Tanzania VAT + /// Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` | Turkish Tax + /// Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification Number + /// | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` | + /// United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT + /// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` + /// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | + /// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | + /// Venezuelan RIF Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | + /// Zambia | `zm_tin` | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` + /// | Zimbabwe Tax Identification Number | /// - public Models::CustomerTaxID? TaxID + public CustomerTaxID? TaxID { get { - if (!this.BodyProperties.TryGetValue("tax_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("tax_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["tax_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["tax_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -464,21 +406,21 @@ public AddressInput? ShippingAddress }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/PaymentProvider.cs b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/PaymentProvider.cs index 850700cd..363d4554 100644 --- a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/PaymentProvider.cs +++ b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/PaymentProvider.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties; @@ -10,8 +9,8 @@ namespace Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties; /// - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, /// `netsuite`), any product mappings must first be configured with the Orb team. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PaymentProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PaymentProvider(string value) : IEnum { public static readonly PaymentProvider Quickbooks = new("quickbooks"); @@ -42,7 +41,7 @@ public Value Known() => "stripe_charge" => Value.StripeCharge, "stripe_invoice" => Value.StripeInvoice, "netsuite" => Value.Netsuite, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfiguration.cs b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfiguration.cs index d30dd455..1def7ade 100644 --- a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfiguration.cs +++ b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfiguration.cs @@ -1,26 +1,21 @@ -using Customers = Orb.Models.Customers; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using TaxConfigurationVariants = Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties.TaxConfigurationVariants; namespace Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class TaxConfiguration { internal TaxConfiguration() { } - public static TaxConfigurationVariants::NewAvalaraTaxConfiguration Create( - Customers::NewAvalaraTaxConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewAvalaraTaxConfiguration value) => + new TaxConfigurationVariants::NewAvalaraTaxConfigurationVariant(value); - public static TaxConfigurationVariants::NewTaxJarConfiguration Create( - Customers::NewTaxJarConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewTaxJarConfiguration value) => + new TaxConfigurationVariants::NewTaxJarConfigurationVariant(value); - public static TaxConfigurationVariants::NewSphereConfiguration Create( - Customers::NewSphereConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewSphereConfiguration value) => + new TaxConfigurationVariants::NewSphereConfigurationVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfigurationVariants/All.cs b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfigurationVariants/All.cs index 43c434bd..cbec9c6e 100644 --- a/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfigurationVariants/All.cs +++ b/src/Orb/Models/Customers/CustomerUpdateByExternalIDParamsProperties/TaxConfigurationVariants/All.cs @@ -1,18 +1,15 @@ -using Customers = Orb.Models.Customers; -using CustomerUpdateByExternalIDParamsProperties = Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerUpdateByExternalIDParamsProperties.TaxConfigurationVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewAvalaraTaxConfiguration(Customers::NewAvalaraTaxConfiguration Value) - : CustomerUpdateByExternalIDParamsProperties::TaxConfiguration, - Orb::IVariant +public sealed record class NewAvalaraTaxConfigurationVariant(NewAvalaraTaxConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewAvalaraTaxConfiguration From(Customers::NewAvalaraTaxConfiguration value) + public static NewAvalaraTaxConfigurationVariant From(NewAvalaraTaxConfiguration value) { return new(value); } @@ -23,14 +20,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewTaxJarConfiguration(Customers::NewTaxJarConfiguration Value) - : CustomerUpdateByExternalIDParamsProperties::TaxConfiguration, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewTaxJarConfigurationVariant(NewTaxJarConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewTaxJarConfiguration From(Customers::NewTaxJarConfiguration value) + public static NewTaxJarConfigurationVariant From(NewTaxJarConfiguration value) { return new(value); } @@ -41,14 +36,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSphereConfiguration(Customers::NewSphereConfiguration Value) - : CustomerUpdateByExternalIDParamsProperties::TaxConfiguration, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSphereConfigurationVariant(NewSphereConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewSphereConfiguration From(Customers::NewSphereConfiguration value) + public static NewSphereConfigurationVariant From(NewSphereConfiguration value) { return new(value); } diff --git a/src/Orb/Models/Customers/CustomerUpdateParams.cs b/src/Orb/Models/Customers/CustomerUpdateParams.cs index 8899481e..a099c62b 100644 --- a/src/Orb/Models/Customers/CustomerUpdateParams.cs +++ b/src/Orb/Models/Customers/CustomerUpdateParams.cs @@ -1,11 +1,9 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using CustomerUpdateParamsProperties = Orb.Models.Customers.CustomerUpdateParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Customers; @@ -15,9 +13,9 @@ namespace Orb.Models.Customers; /// `billing_address`, and `additional_emails` of an existing customer. Other fields /// on a customer are currently immutable. /// -public sealed record class CustomerUpdateParams : Orb::ParamsBase +public sealed record class CustomerUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string CustomerID; @@ -28,17 +26,17 @@ public NewAccountingSyncConfiguration? AccountingSyncConfiguration if ( !this.BodyProperties.TryGetValue( "accounting_sync_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["accounting_sync_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -46,23 +44,16 @@ public NewAccountingSyncConfiguration? AccountingSyncConfiguration /// Additional email addresses for this customer. If populated, these email addresses /// will be CC'd for customer communications. /// - public Generic::List? AdditionalEmails + public List? AdditionalEmails { get { - if ( - !this.BodyProperties.TryGetValue("additional_emails", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("additional_emails", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.BodyProperties["additional_emails"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.BodyProperties["additional_emails"] = JsonSerializer.SerializeToElement(value); } } /// @@ -74,30 +65,24 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("auto_collection", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public AddressInput? BillingAddress { get { - if (!this.BodyProperties.TryGetValue("billing_address", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("billing_address", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["billing_address"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["billing_address"] = JsonSerializer.SerializeToElement(value); } } /// @@ -108,12 +93,12 @@ public string? Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -123,52 +108,44 @@ public string? Email { get { - if (!this.BodyProperties.TryGetValue("email", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("email", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["email"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["email"] = JsonSerializer.SerializeToElement(value); } } public bool? EmailDelivery { get { - if (!this.BodyProperties.TryGetValue("email_delivery", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("email_delivery", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["email_delivery"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["email_delivery"] = JsonSerializer.SerializeToElement(value); } } /// - /// The external customer ID. This can only be set if empty and the customer has - /// no past or current subscriptions. + /// The external customer ID. This can only be set if the customer has no existing + /// external customer ID. Since this action may change usage quantities for all + /// existing subscriptions, it is disallowed if the customer has issued invoices + /// with usage line items and subject to the same restrictions as backdated subscription creation. /// public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -179,12 +156,12 @@ public CustomerHierarchyConfig? Hierarchy { get { - if (!this.BodyProperties.TryGetValue("hierarchy", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("hierarchy", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["hierarchy"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["hierarchy"] = JsonSerializer.SerializeToElement(value); } } /// @@ -192,16 +169,16 @@ public CustomerHierarchyConfig? Hierarchy /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -211,12 +188,12 @@ public string? Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -230,19 +207,14 @@ public string? Name { get { - if (!this.BodyProperties.TryGetValue("payment_provider", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("payment_provider", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["payment_provider"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["payment_provider"] = JsonSerializer.SerializeToElement(value); } } /// @@ -253,21 +225,14 @@ public string? PaymentProviderID { get { - if ( - !this.BodyProperties.TryGetValue( - "payment_provider_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("payment_provider_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["payment_provider_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["payment_provider_id"] = JsonSerializer.SerializeToElement(value); } } @@ -276,19 +241,17 @@ public NewReportingConfiguration? ReportingConfiguration get { if ( - !this.BodyProperties.TryGetValue( - "reporting_configuration", - out Json::JsonElement element - ) + !this.BodyProperties.TryGetValue("reporting_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["reporting_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["reporting_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -296,38 +259,26 @@ public AddressInput? ShippingAddress { get { - if (!this.BodyProperties.TryGetValue("shipping_address", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("shipping_address", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["shipping_address"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["shipping_address"] = JsonSerializer.SerializeToElement(value); } } public CustomerUpdateParamsProperties::TaxConfiguration? TaxConfiguration { get { - if ( - !this.BodyProperties.TryGetValue("tax_configuration", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("tax_configuration", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["tax_configuration"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["tax_configuration"] = JsonSerializer.SerializeToElement(value); } } /// @@ -336,125 +287,116 @@ public AddressInput? ShippingAddress /// /// ### Supported Tax ID Countries and Types /// - /// | Country | Type | Description - /// | |----------------|--------------|---------------------------------------------| - /// | Andorra | `ad_nrt` | Andorran NRT Number - /// | | Argentina | `ar_cuit` | Argentinian Tax ID Number - /// | | Australia | `au_abn` | Australian Business Number (AU ABN) - /// | | Australia | `au_arn` | Australian Taxation Office - /// Reference Number | | Austria | `eu_vat` | European VAT Number - /// | | Bahrain | `bh_vat` | Bahraini VAT Number - /// | | Belgium | `eu_vat` | European VAT Number - /// | | Bolivia | `bo_tin` | Bolivian Tax ID - /// | | Brazil | `br_cnpj` | Brazilian CNPJ - /// Number | | Brazil | `br_cpf` | Brazilian CPF - /// Number | | Bulgaria | `bg_uic` | Bulgaria - /// Unified Identification Code | | Bulgaria | `eu_vat` | European - /// VAT Number | | Canada | `ca_bn` | Canadian - /// BN | | Canada | `ca_gst_hst` | Canadian - /// GST/HST Number | | Canada | `ca_pst_bc` | Canadian - /// PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian - /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian - /// PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian - /// QST Number (Québec) | | Chile | `cl_tin` | Chilean - /// TIN | | China | `cn_tin` | Chinese - /// Tax ID | | Colombia | `co_nit` | Colombian - /// NIT Number | | Costa Rica | `cr_tin` | Costa - /// Rican Tax ID | | Croatia | `eu_vat` | European - /// VAT Number | | Cyprus | `eu_vat` | European - /// VAT Number | | Czech Republic | `eu_vat` | European - /// VAT Number | | Denmark | `eu_vat` | European - /// VAT Number | | Dominican Republic | `do_rcn` | Dominican - /// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian - /// RUC Number | | Egypt | `eg_tin` | Egyptian - /// Tax Identification Number | | El Salvador | `sv_nit` - /// | El Salvadorian NIT Number | | Estonia | `eu_vat` | - /// European VAT Number | | EU | `eu_oss_vat` | European One Stop Shop - /// VAT Number for non-Union scheme | | Finland | `eu_vat` | European VAT - /// Number | | France | `eu_vat` | European - /// VAT Number | | Georgia | `ge_vat` | - /// Georgian VAT | | Germany | `eu_vat` - /// | European VAT Number | | Greece - /// | `eu_vat` | European VAT Number | | - /// Hong Kong | `hk_br` | Hong Kong BR Number - /// | | Hungary | `eu_vat` | European VAT Number - /// | | Hungary | `hu_tin` | Hungary Tax Number (adószám) - /// | | Iceland | `is_vat` | Icelandic VAT - /// | | India | `in_gst` | Indian GST - /// Number | | Indonesia | `id_npwp` | Indonesian - /// NPWP Number | | Ireland | `eu_vat` | - /// European VAT Number | | Israel | `il_vat` - /// | Israel VAT | | Italy - /// | `eu_vat` | European VAT Number | | - /// Japan | `jp_cn` | Japanese Corporate Number (*Hōjin Bangō*) - /// | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' - /// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | - /// Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) - /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification - /// Number | | Kenya | `ke_pin` | Kenya Revenue Authority - /// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number - /// | | Liechtenstein | `li_uid` | Liechtensteinian - /// UID Number | | Lithuania | `eu_vat` | European VAT Number - /// | | Luxembourg | `eu_vat` | European VAT Number - /// | | Malaysia | `my_frp` | Malaysian FRP Number - /// | | Malaysia | `my_itn` | Malaysian ITN - /// | | Malaysia | `my_sst` | Malaysian SST Number | - /// | Malta | `eu_vat ` | European VAT Number | | Mexico - /// | `mx_rfc` | Mexican RFC Number | | Netherlands - /// | `eu_vat` | European VAT Number | | New Zealand | - /// `nz_gst` | New Zealand GST Number | | Nigeria | - /// `ng_tin` | Nigerian Tax Identification Number | | Norway | `no_vat` - /// | Norwegian VAT Number | | Norway | `no_voec` | Norwegian - /// VAT on e-commerce Number | | Oman | `om_vat` | Omani VAT Number - /// | | Peru | `pe_ruc` | Peruvian RUC Number - /// | | Philippines | `ph_tin ` | Philippines Tax Identification - /// Number | | Poland | `eu_vat` | European VAT Number - /// | | Portugal | `eu_vat` | European VAT Number | | - /// Romania | `eu_vat` | European VAT Number | | Romania - /// | `ro_tin` | Romanian Tax ID Number | | Russia - /// | `ru_inn` | Russian INN | | Russia | `ru_kpp` - /// | Russian KPP | | Saudi Arabia | `sa_vat` | Saudi - /// Arabia VAT | | Serbia | `rs_pib` | Serbian PIB - /// Number | | Singapore | `sg_gst` | Singaporean GST - /// | | Singapore | `sg_uen` | Singaporean UEN - /// | | Slovakia | `eu_vat` | European VAT Number - /// | | Slovenia | `eu_vat` | European VAT Number - /// | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) - /// | | South Africa | `za_vat` | South African VAT - /// Number | | South Korea | `kr_brn` | Korean - /// BRN | | Spain | `es_cif` - /// | Spanish NIF Number (previously Spanish CIF Number) | | Spain - /// | `eu_vat` | European VAT Number | | - /// Sweden | `eu_vat` | European VAT Number - /// | | Switzerland | `ch_vat` | Switzerland VAT Number - /// | | Taiwan | `tw_vat` | Taiwanese VAT - /// | | Thailand | `th_vat` | - /// Thai VAT | | Turkey - /// | `tr_tin` | Turkish Tax Identification Number | | Ukraine - /// | `ua_vat` | Ukrainian VAT - /// | | United Arab Emirates | `ae_trn` | United Arab Emirates TRN - /// | | United Kingdom | `eu_vat` | Northern Ireland - /// VAT Number | | United Kingdom | `gb_vat` | United - /// Kingdom VAT Number | | United States | `us_ein` - /// | United States EIN | | Uruguay - /// | `uy_ruc` | Uruguayan RUC Number | | Venezuela - /// | `ve_rif` | Venezuelan RIF Number - /// | | Vietnam | `vn_tin` | Vietnamese Tax ID Number - /// | + /// | Country | Type | Description | |---------|------|-------------| | Albania + /// | `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran + /// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina + /// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax + /// Identification Number | | Aruba | `aw_tin` | Aruba Tax Identification Number + /// | | Australia | `au_abn` | Australian Business Number (AU ABN) | | Australia + /// | `au_arn` | Australian Taxation Office Reference Number | | Austria | `eu_vat` + /// | European VAT Number | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification + /// Number | | Bahamas | `bs_tin` | Bahamas Tax Identification Number | | Bahrain + /// | `bh_vat` | Bahraini VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business + /// Identification Number | | Barbados | `bb_tin` | Barbados Tax Identification + /// Number | | Belarus | `by_tin` | Belarus TIN Number | | Belgium | `eu_vat` | + /// European VAT Number | | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant + /// Fiscal Unique) | | Bolivia | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina + /// | `ba_tin` | Bosnia and Herzegovina Tax Identification Number | | Brazil | `br_cnpj` + /// | Brazilian CNPJ Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria + /// | `bg_uic` | Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | + /// European VAT Number | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification + /// Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia + /// Tax Identification Number | | Cameroon | `cm_niu` | Cameroon Tax Identification + /// Number (Numéro d'Identifiant fiscal Unique) | | Canada | `ca_bn` | Canadian + /// BN | | Canada | `ca_gst_hst` | Canadian GST/HST Number | | Canada | `ca_pst_bc` + /// | Canadian PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian + /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) + /// | | Canada | `ca_qst` | Canadian QST Number (Québec) | | Cape Verde | `cv_nif` + /// | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | + /// Chile | `cl_tin` | Chilean TIN | | China | `cn_tin` | Chinese Tax ID | | Colombia + /// | `co_nit` | Colombian NIT Number | | Congo-Kinshasa | `cd_nif` | Congo (DR) + /// Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | + /// `cr_tin` | Costa Rican Tax ID | | Croatia | `eu_vat` | European VAT Number | + /// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) | | Cyprus + /// | `eu_vat` | European VAT Number | | Czech Republic | `eu_vat` | European VAT + /// Number | | Denmark | `eu_vat` | European VAT Number | | Dominican Republic + /// | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` | Ecuadorian RUC Number + /// | | Egypt | `eg_tin` | Egyptian Tax Identification Number | | El Salvador | + /// `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` | European VAT + /// Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number | | European + /// Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme + /// | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European + /// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German + /// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | + /// Greece | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification + /// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong + /// BR Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` + /// | Hungary Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India + /// | `in_gst` | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP + /// Number | | Ireland | `eu_vat` | European VAT Number | | Israel | `il_vat` | + /// Israel VAT | | Italy | `eu_vat` | European VAT Number | | Japan | `jp_cn` | + /// Japanese Corporate Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered + /// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku + /// Bangō*) | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) + /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number | | + /// Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + /// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number | | Laos | `la_tin` + /// | Laos Tax Identification Number | | Latvia | `eu_vat` | European VAT Number + /// | | Liechtenstein | `li_uid` | Liechtensteinian UID Number | | Liechtenstein + /// | `li_vat` | Liechtenstein VAT Number | | Lithuania | `eu_vat` | European VAT + /// Number | | Luxembourg | `eu_vat` | European VAT Number | | Malaysia | `my_frp` + /// | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian ITN | | Malaysia + /// | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European VAT Number + /// | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de + /// Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova + /// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB + /// Number | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal + /// PAN Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand + /// | `nz_gst` | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification + /// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern + /// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian + /// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman + /// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | + /// Philippines | `ph_tin` | Philippines Tax Identification Number | | Poland | + /// `eu_vat` | European VAT Number | | Portugal | `eu_vat` | European VAT Number + /// | | Romania | `eu_vat` | European VAT Number | | Romania | `ro_tin` | Romanian + /// Tax ID Number | | Russia | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian + /// KPP | | Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` + /// | Senegal NINEA Number | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore + /// | `sg_gst` | Singaporean GST | | Singapore | `sg_uen` | Singaporean UEN | | + /// Slovakia | `eu_vat` | European VAT Number | | Slovenia | `eu_vat` | European + /// VAT Number | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) | + /// | South Africa | `za_vat` | South African VAT Number | | South Korea | `kr_brn` + /// | Korean BRN | | Spain | `es_cif` | Spanish NIF Number (previously Spanish + /// CIF Number) | | Spain | `eu_vat` | European VAT Number | | Suriname | `sr_fin` + /// | Suriname FIN Number | | Sweden | `eu_vat` | European VAT Number | | Switzerland + /// | `ch_uid` | Switzerland UID Number | | Switzerland | `ch_vat` | Switzerland + /// VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | Tajikistan | `tj_tin` + /// | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` | Tanzania VAT + /// Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` | Turkish Tax + /// Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification Number + /// | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` | + /// United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT + /// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` + /// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | + /// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | + /// Venezuelan RIF Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | + /// Zambia | `zm_tin` | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` + /// | Zimbabwe Tax Identification Number | /// - public Models::CustomerTaxID? TaxID + public CustomerTaxID? TaxID { get { - if (!this.BodyProperties.TryGetValue("tax_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("tax_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["tax_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["tax_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -465,21 +407,21 @@ public AddressInput? ShippingAddress }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Customers/CustomerUpdateParamsProperties/PaymentProvider.cs b/src/Orb/Models/Customers/CustomerUpdateParamsProperties/PaymentProvider.cs index 5654a639..9060f00b 100644 --- a/src/Orb/Models/Customers/CustomerUpdateParamsProperties/PaymentProvider.cs +++ b/src/Orb/Models/Customers/CustomerUpdateParamsProperties/PaymentProvider.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerUpdateParamsProperties; @@ -10,8 +9,8 @@ namespace Orb.Models.Customers.CustomerUpdateParamsProperties; /// - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, /// `netsuite`), any product mappings must first be configured with the Orb team. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PaymentProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PaymentProvider(string value) : IEnum { public static readonly PaymentProvider Quickbooks = new("quickbooks"); @@ -42,7 +41,7 @@ public Value Known() => "stripe_charge" => Value.StripeCharge, "stripe_invoice" => Value.StripeInvoice, "netsuite" => Value.Netsuite, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfiguration.cs b/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfiguration.cs index 338cf86e..933b2c8d 100644 --- a/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfiguration.cs +++ b/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfiguration.cs @@ -1,26 +1,21 @@ -using Customers = Orb.Models.Customers; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using TaxConfigurationVariants = Orb.Models.Customers.CustomerUpdateParamsProperties.TaxConfigurationVariants; namespace Orb.Models.Customers.CustomerUpdateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class TaxConfiguration { internal TaxConfiguration() { } - public static TaxConfigurationVariants::NewAvalaraTaxConfiguration Create( - Customers::NewAvalaraTaxConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewAvalaraTaxConfiguration value) => + new TaxConfigurationVariants::NewAvalaraTaxConfigurationVariant(value); - public static TaxConfigurationVariants::NewTaxJarConfiguration Create( - Customers::NewTaxJarConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewTaxJarConfiguration value) => + new TaxConfigurationVariants::NewTaxJarConfigurationVariant(value); - public static TaxConfigurationVariants::NewSphereConfiguration Create( - Customers::NewSphereConfiguration value - ) => new(value); + public static implicit operator TaxConfiguration(NewSphereConfiguration value) => + new TaxConfigurationVariants::NewSphereConfigurationVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfigurationVariants/All.cs b/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfigurationVariants/All.cs index 21935bd2..0e5bc83e 100644 --- a/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfigurationVariants/All.cs +++ b/src/Orb/Models/Customers/CustomerUpdateParamsProperties/TaxConfigurationVariants/All.cs @@ -1,18 +1,15 @@ -using Customers = Orb.Models.Customers; -using CustomerUpdateParamsProperties = Orb.Models.Customers.CustomerUpdateParamsProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.CustomerUpdateParamsProperties.TaxConfigurationVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewAvalaraTaxConfiguration(Customers::NewAvalaraTaxConfiguration Value) - : CustomerUpdateParamsProperties::TaxConfiguration, - Orb::IVariant +public sealed record class NewAvalaraTaxConfigurationVariant(NewAvalaraTaxConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewAvalaraTaxConfiguration From(Customers::NewAvalaraTaxConfiguration value) + public static NewAvalaraTaxConfigurationVariant From(NewAvalaraTaxConfiguration value) { return new(value); } @@ -23,14 +20,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewTaxJarConfiguration(Customers::NewTaxJarConfiguration Value) - : CustomerUpdateParamsProperties::TaxConfiguration, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewTaxJarConfigurationVariant(NewTaxJarConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewTaxJarConfiguration From(Customers::NewTaxJarConfiguration value) + public static NewTaxJarConfigurationVariant From(NewTaxJarConfiguration value) { return new(value); } @@ -41,14 +36,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSphereConfiguration(Customers::NewSphereConfiguration Value) - : CustomerUpdateParamsProperties::TaxConfiguration, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSphereConfigurationVariant(NewSphereConfiguration Value) + : TaxConfiguration, + IVariant { - public static NewSphereConfiguration From(Customers::NewSphereConfiguration value) + public static NewSphereConfigurationVariant From(NewSphereConfiguration value) { return new(value); } diff --git a/src/Orb/Models/Customers/NewAccountingSyncConfiguration.cs b/src/Orb/Models/Customers/NewAccountingSyncConfiguration.cs index 75706a9e..a81ae6ab 100644 --- a/src/Orb/Models/Customers/NewAccountingSyncConfiguration.cs +++ b/src/Orb/Models/Customers/NewAccountingSyncConfiguration.cs @@ -1,45 +1,37 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewAccountingSyncConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public Generic::List? AccountingProviders + public List? AccountingProviders { get { - if (!this.Properties.TryGetValue("accounting_providers", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("accounting_providers", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); - } - set - { - this.Properties["accounting_providers"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["accounting_providers"] = JsonSerializer.SerializeToElement(value); } } public bool? Excluded { get { - if (!this.Properties.TryGetValue("excluded", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("excluded", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["excluded"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["excluded"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,15 +46,15 @@ public override void Validate() public NewAccountingSyncConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewAccountingSyncConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewAccountingSyncConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewAccountingSyncConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/NewAvalaraTaxConfiguration.cs b/src/Orb/Models/Customers/NewAvalaraTaxConfiguration.cs index 98cbc46f..8cd76272 100644 --- a/src/Orb/Models/Customers/NewAvalaraTaxConfiguration.cs +++ b/src/Orb/Models/Customers/NewAvalaraTaxConfiguration.cs @@ -1,63 +1,59 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewAvalaraTaxConfigurationProperties = Orb.Models.Customers.NewAvalaraTaxConfigurationProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewAvalaraTaxConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required bool TaxExempt { get { - if (!this.Properties.TryGetValue("tax_exempt", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_exempt", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_exempt", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["tax_exempt"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_exempt"] = JsonSerializer.SerializeToElement(value); } } public required NewAvalaraTaxConfigurationProperties::TaxProvider TaxProvider { get { - if (!this.Properties.TryGetValue("tax_provider", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_provider", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_provider", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("tax_provider"); } - set { this.Properties["tax_provider"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_provider"] = JsonSerializer.SerializeToElement(value); } } public string? TaxExemptionCode { get { - if (!this.Properties.TryGetValue("tax_exemption_code", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_exemption_code", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["tax_exemption_code"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["tax_exemption_code"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -70,15 +66,15 @@ public override void Validate() public NewAvalaraTaxConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewAvalaraTaxConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewAvalaraTaxConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewAvalaraTaxConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/NewAvalaraTaxConfigurationProperties/TaxProvider.cs b/src/Orb/Models/Customers/NewAvalaraTaxConfigurationProperties/TaxProvider.cs index 413280ba..9d05949e 100644 --- a/src/Orb/Models/Customers/NewAvalaraTaxConfigurationProperties/TaxProvider.cs +++ b/src/Orb/Models/Customers/NewAvalaraTaxConfigurationProperties/TaxProvider.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.NewAvalaraTaxConfigurationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class TaxProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class TaxProvider(string value) : IEnum { public static readonly TaxProvider Avalara = new("avalara"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "avalara" => Value.Avalara, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/NewReportingConfiguration.cs b/src/Orb/Models/Customers/NewReportingConfiguration.cs index 03b51715..5d5016d5 100644 --- a/src/Orb/Models/Customers/NewReportingConfiguration.cs +++ b/src/Orb/Models/Customers/NewReportingConfiguration.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewReportingConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required bool Exempt { get { - if (!this.Properties.TryGetValue("exempt", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("exempt", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "exempt", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["exempt"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["exempt"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -35,15 +34,15 @@ public override void Validate() public NewReportingConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewReportingConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewReportingConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewReportingConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/NewSphereConfiguration.cs b/src/Orb/Models/Customers/NewSphereConfiguration.cs index 57a40c58..17e7a0e9 100644 --- a/src/Orb/Models/Customers/NewSphereConfiguration.cs +++ b/src/Orb/Models/Customers/NewSphereConfiguration.cs @@ -1,48 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSphereConfigurationProperties = Orb.Models.Customers.NewSphereConfigurationProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewSphereConfiguration - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewSphereConfiguration : ModelBase, IFromRaw { public required bool TaxExempt { get { - if (!this.Properties.TryGetValue("tax_exempt", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_exempt", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_exempt", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["tax_exempt"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_exempt"] = JsonSerializer.SerializeToElement(value); } } public required NewSphereConfigurationProperties::TaxProvider TaxProvider { get { - if (!this.Properties.TryGetValue("tax_provider", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_provider", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_provider", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("tax_provider"); } - set { this.Properties["tax_provider"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_provider"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,15 +51,15 @@ public override void Validate() public NewSphereConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSphereConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSphereConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSphereConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/NewSphereConfigurationProperties/TaxProvider.cs b/src/Orb/Models/Customers/NewSphereConfigurationProperties/TaxProvider.cs index 2d505002..11451091 100644 --- a/src/Orb/Models/Customers/NewSphereConfigurationProperties/TaxProvider.cs +++ b/src/Orb/Models/Customers/NewSphereConfigurationProperties/TaxProvider.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.NewSphereConfigurationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class TaxProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class TaxProvider(string value) : IEnum { public static readonly TaxProvider Sphere = new("sphere"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "sphere" => Value.Sphere, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Customers/NewTaxJarConfiguration.cs b/src/Orb/Models/Customers/NewTaxJarConfiguration.cs index 9aa7340e..f5532b8c 100644 --- a/src/Orb/Models/Customers/NewTaxJarConfiguration.cs +++ b/src/Orb/Models/Customers/NewTaxJarConfiguration.cs @@ -1,48 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewTaxJarConfigurationProperties = Orb.Models.Customers.NewTaxJarConfigurationProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Customers; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewTaxJarConfiguration - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewTaxJarConfiguration : ModelBase, IFromRaw { public required bool TaxExempt { get { - if (!this.Properties.TryGetValue("tax_exempt", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_exempt", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_exempt", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["tax_exempt"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_exempt"] = JsonSerializer.SerializeToElement(value); } } public required NewTaxJarConfigurationProperties::TaxProvider TaxProvider { get { - if (!this.Properties.TryGetValue("tax_provider", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_provider", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_provider", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("tax_provider"); } - set { this.Properties["tax_provider"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_provider"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,15 +51,15 @@ public override void Validate() public NewTaxJarConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewTaxJarConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewTaxJarConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewTaxJarConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Customers/NewTaxJarConfigurationProperties/TaxProvider.cs b/src/Orb/Models/Customers/NewTaxJarConfigurationProperties/TaxProvider.cs index 650a4322..a6c2cd75 100644 --- a/src/Orb/Models/Customers/NewTaxJarConfigurationProperties/TaxProvider.cs +++ b/src/Orb/Models/Customers/NewTaxJarConfigurationProperties/TaxProvider.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Customers.NewTaxJarConfigurationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class TaxProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class TaxProvider(string value) : IEnum { public static readonly TaxProvider Taxjar = new("taxjar"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "taxjar" => Value.Taxjar, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/DimensionalPriceConfiguration.cs b/src/Orb/Models/DimensionalPriceConfiguration.cs index 4a979e69..7700bf9b 100644 --- a/src/Orb/Models/DimensionalPriceConfiguration.cs +++ b/src/Orb/Models/DimensionalPriceConfiguration.cs @@ -1,57 +1,48 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class DimensionalPriceConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List DimensionValues + public required List DimensionValues { get { - if (!this.Properties.TryGetValue("dimension_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("dimension_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimension_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("dimension_values"); } - set - { - this.Properties["dimension_values"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["dimension_values"] = JsonSerializer.SerializeToElement(value); } } public required string DimensionalPriceGroupID { get { - if ( - !this.Properties.TryGetValue( - "dimensional_price_group_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("dimensional_price_group_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimensional_price_group_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("dimensional_price_group_id"); } set { - this.Properties["dimensional_price_group_id"] = Json::JsonSerializer.SerializeToElement( + this.Properties["dimensional_price_group_id"] = JsonSerializer.SerializeToElement( value ); } @@ -69,15 +60,15 @@ public override void Validate() public DimensionalPriceConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - DimensionalPriceConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + DimensionalPriceConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static DimensionalPriceConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroup.cs b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroup.cs index 08d56e9f..0ca8fbcf 100644 --- a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroup.cs +++ b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroup.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.DimensionalPriceGroups; @@ -12,22 +11,20 @@ namespace Orb.Models.DimensionalPriceGroups; /// by a set of dimensions. Prices in a price group must specify the parition used /// to derive their usage. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class DimensionalPriceGroup - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class DimensionalPriceGroup : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,38 +35,32 @@ public required string BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billable_metric_id"); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billable_metric_id"); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// /// The dimensions that this dimensional price group is defined over /// - public required Generic::List Dimensions + public required List Dimensions { get { - if (!this.Properties.TryGetValue("dimensions", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "dimensions", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("dimensions", out JsonElement element)) + throw new ArgumentOutOfRangeException("dimensions", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("dimensions"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("dimensions"); } - set { this.Properties["dimensions"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["dimensions"] = JsonSerializer.SerializeToElement(value); } } /// @@ -82,20 +73,20 @@ public required string? ExternalDimensionalPriceGroupID if ( !this.Properties.TryGetValue( "external_dimensional_price_group_id", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "external_dimensional_price_group_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.Properties["external_dimensional_price_group_id"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -105,20 +96,17 @@ public required string? ExternalDimensionalPriceGroupID /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,13 +116,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -156,16 +144,14 @@ public override void Validate() public DimensionalPriceGroup() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - DimensionalPriceGroup(Generic::Dictionary properties) + [SetsRequiredMembers] + DimensionalPriceGroup(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static DimensionalPriceGroup FromRawUnchecked( - Generic::Dictionary properties - ) + public static DimensionalPriceGroup FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupCreateParams.cs b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupCreateParams.cs index 8a5c2768..deabe5ae 100644 --- a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupCreateParams.cs +++ b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupCreateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.DimensionalPriceGroups; @@ -17,66 +16,56 @@ namespace Orb.Models.DimensionalPriceGroups; /// can create a price group with a dimension "color" and two prices: one that charges /// \$10 per red widget and one that charges \$20 per blue widget. /// -public sealed record class DimensionalPriceGroupCreateParams : Orb::ParamsBase +public sealed record class DimensionalPriceGroupCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string BillableMetricID { get { - if ( - !this.BodyProperties.TryGetValue( - "billable_metric_id", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("billable_metric_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billable_metric_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billable_metric_id"); } set { - this.BodyProperties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of keys (in order) used to disambiguate prices in the group. /// - public required Generic::List Dimensions + public required List Dimensions { get { - if (!this.BodyProperties.TryGetValue("dimensions", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "dimensions", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("dimensions", out JsonElement element)) + throw new ArgumentOutOfRangeException("dimensions", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("dimensions"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("dimensions"); } - set { this.BodyProperties["dimensions"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["dimensions"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } public string? ExternalDimensionalPriceGroupID @@ -86,17 +75,17 @@ public string? ExternalDimensionalPriceGroupID if ( !this.BodyProperties.TryGetValue( "external_dimensional_price_group_id", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["external_dimensional_price_group_id"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -105,43 +94,41 @@ public string? ExternalDimensionalPriceGroupID /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( - client.BaseUrl.ToString().TrimEnd('/') + "/dimensional_price_groups" - ) + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/dimensional_price_groups") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupListParams.cs b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupListParams.cs index 985669e6..dcb282f5 100644 --- a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupListParams.cs +++ b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupListParams.cs @@ -1,14 +1,13 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.DimensionalPriceGroups; /// /// List dimensional price groups /// -public sealed record class DimensionalPriceGroupListParams : Orb::ParamsBase +public sealed record class DimensionalPriceGroupListParams : ParamsBase { /// /// Cursor for pagination. This can be populated by the `next_cursor` value returned @@ -18,12 +17,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -33,30 +32,28 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( - client.BaseUrl.ToString().TrimEnd('/') + "/dimensional_price_groups" - ) + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/dimensional_price_groups") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupRetrieveParams.cs b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupRetrieveParams.cs index a0fbb959..4f97d1b1 100644 --- a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupRetrieveParams.cs +++ b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupRetrieveParams.cs @@ -1,19 +1,18 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.DimensionalPriceGroups; /// /// Fetch dimensional price group /// -public sealed record class DimensionalPriceGroupRetrieveParams : Orb::ParamsBase +public sealed record class DimensionalPriceGroupRetrieveParams : ParamsBase { public required string DimensionalPriceGroupID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/dimensional_price_groups/{0}", this.DimensionalPriceGroupID) ) @@ -22,12 +21,12 @@ public sealed record class DimensionalPriceGroupRetrieveParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupUpdateParams.cs b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupUpdateParams.cs new file mode 100644 index 00000000..719182bc --- /dev/null +++ b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroupUpdateParams.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; + +namespace Orb.Models.DimensionalPriceGroups; + +/// +/// This endpoint can be used to update the `external_dimensional_price_group_id` +/// and `metadata` of an existing dimensional price group. Other fields on a dimensional +/// price group are currently immutable. +/// +public sealed record class DimensionalPriceGroupUpdateParams : ParamsBase +{ + public Dictionary BodyProperties { get; set; } = []; + + public required string DimensionalPriceGroupID; + + /// + /// An optional user-defined ID for this dimensional price group resource, used + /// throughout the system as an alias for this dimensional price group. Use this + /// field to identify a dimensional price group by an existing identifier in your system. + /// + public string? ExternalDimensionalPriceGroupID + { + get + { + if ( + !this.BodyProperties.TryGetValue( + "external_dimensional_price_group_id", + out JsonElement element + ) + ) + return null; + + return JsonSerializer.Deserialize(element); + } + set + { + this.BodyProperties["external_dimensional_price_group_id"] = + JsonSerializer.SerializeToElement(value); + } + } + + /// + /// User-specified key/value pairs for the resource. Individual keys can be removed + /// by setting the value to `null`, and the entire metadata mapping can be cleared + /// by setting `metadata` to `null`. + /// + public Dictionary? Metadata + { + get + { + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) + return null; + + return JsonSerializer.Deserialize?>(element); + } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } + } + + public override Uri Url(IOrbClient client) + { + return new UriBuilder( + client.BaseUrl.ToString().TrimEnd('/') + + string.Format("/dimensional_price_groups/{0}", this.DimensionalPriceGroupID) + ) + { + Query = this.QueryString(client), + }.Uri; + } + + public StringContent BodyContent() + { + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, + "application/json" + ); + } + + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) + { + ParamsBase.AddDefaultHeaders(request, client); + foreach (var item in this.HeaderProperties) + { + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + } + } +} diff --git a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroups.cs b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroups.cs index fbd94dbe..ca48243d 100644 --- a/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroups.cs +++ b/src/Orb/Models/DimensionalPriceGroups/DimensionalPriceGroups.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.DimensionalPriceGroups; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class DimensionalPriceGroups - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class DimensionalPriceGroups : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,15 +51,15 @@ public override void Validate() public DimensionalPriceGroups() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - DimensionalPriceGroups(Generic::Dictionary properties) + [SetsRequiredMembers] + DimensionalPriceGroups(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static DimensionalPriceGroups FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDRetrieveParams.cs b/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDRetrieveParams.cs index e1cb6200..ef4e610c 100644 --- a/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDRetrieveParams.cs +++ b/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDRetrieveParams.cs @@ -1,19 +1,18 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; /// /// Fetch dimensional price group by external ID /// -public sealed record class ExternalDimensionalPriceGroupIDRetrieveParams : Orb::ParamsBase +public sealed record class ExternalDimensionalPriceGroupIDRetrieveParams : ParamsBase { public required string ExternalDimensionalPriceGroupID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format( "/dimensional_price_groups/external_dimensional_price_group_id/{0}", @@ -25,12 +24,12 @@ public sealed record class ExternalDimensionalPriceGroupIDRetrieveParams : Orb:: }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDUpdateParams.cs b/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDUpdateParams.cs new file mode 100644 index 00000000..5efe8891 --- /dev/null +++ b/src/Orb/Models/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDUpdateParams.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; + +namespace Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; + +/// +/// This endpoint can be used to update the `external_dimensional_price_group_id` +/// and `metadata` of an existing dimensional price group. Other fields on a dimensional +/// price group are currently immutable. +/// +public sealed record class ExternalDimensionalPriceGroupIDUpdateParams : ParamsBase +{ + public Dictionary BodyProperties { get; set; } = []; + + public required string ExternalDimensionalPriceGroupID; + + /// + /// An optional user-defined ID for this dimensional price group resource, used + /// throughout the system as an alias for this dimensional price group. Use this + /// field to identify a dimensional price group by an existing identifier in your system. + /// + public string? ExternalDimensionalPriceGroupID1 + { + get + { + if ( + !this.BodyProperties.TryGetValue( + "external_dimensional_price_group_id", + out JsonElement element + ) + ) + return null; + + return JsonSerializer.Deserialize(element); + } + set + { + this.BodyProperties["external_dimensional_price_group_id"] = + JsonSerializer.SerializeToElement(value); + } + } + + /// + /// User-specified key/value pairs for the resource. Individual keys can be removed + /// by setting the value to `null`, and the entire metadata mapping can be cleared + /// by setting `metadata` to `null`. + /// + public Dictionary? Metadata + { + get + { + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) + return null; + + return JsonSerializer.Deserialize?>(element); + } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } + } + + public override Uri Url(IOrbClient client) + { + return new UriBuilder( + client.BaseUrl.ToString().TrimEnd('/') + + string.Format( + "/dimensional_price_groups/external_dimensional_price_group_id/{0}", + this.ExternalDimensionalPriceGroupID + ) + ) + { + Query = this.QueryString(client), + }.Uri; + } + + public StringContent BodyContent() + { + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, + "application/json" + ); + } + + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) + { + ParamsBase.AddDefaultHeaders(request, client); + foreach (var item in this.HeaderProperties) + { + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + } + } +} diff --git a/src/Orb/Models/Discount.cs b/src/Orb/Models/Discount.cs deleted file mode 100644 index 92b0dd33..00000000 --- a/src/Orb/Models/Discount.cs +++ /dev/null @@ -1,22 +0,0 @@ -using DiscountVariants = Orb.Models.DiscountVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models; - -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Discount -{ - internal Discount() { } - - public static DiscountVariants::PercentageDiscount Create(PercentageDiscount value) => - new(value); - - public static DiscountVariants::TrialDiscount Create(TrialDiscount value) => new(value); - - public static DiscountVariants::UsageDiscount Create(UsageDiscount value) => new(value); - - public static DiscountVariants::AmountDiscount Create(AmountDiscount value) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Discount2.cs b/src/Orb/Models/Discount2.cs new file mode 100644 index 00000000..ad9ba83f --- /dev/null +++ b/src/Orb/Models/Discount2.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; +using DiscountVariants = Orb.Models.DiscountVariants; + +namespace Orb.Models; + +[JsonConverter(typeof(UnionConverter))] +public abstract record class Discount2 +{ + internal Discount2() { } + + public static implicit operator Discount2(PercentageDiscount value) => + new DiscountVariants::PercentageDiscountVariant(value); + + public static implicit operator Discount2(TrialDiscount value) => + new DiscountVariants::TrialDiscountVariant(value); + + public static implicit operator Discount2(UsageDiscount value) => + new DiscountVariants::UsageDiscountVariant(value); + + public static implicit operator Discount2(AmountDiscount value) => + new DiscountVariants::AmountDiscountVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/DiscountVariants/All.cs b/src/Orb/Models/DiscountVariants/All.cs index e1f866a6..d1f273c4 100644 --- a/src/Orb/Models/DiscountVariants/All.cs +++ b/src/Orb/Models/DiscountVariants/All.cs @@ -1,17 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.DiscountVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class PercentageDiscount(Models::PercentageDiscount Value) - : Models::Discount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class PercentageDiscountVariant(PercentageDiscount Value) + : Discount2, + IVariant { - public static PercentageDiscount From(Models::PercentageDiscount value) + public static PercentageDiscountVariant From(PercentageDiscount value) { return new(value); } @@ -22,12 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class TrialDiscount(Models::TrialDiscount Value) - : Models::Discount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class TrialDiscountVariant(TrialDiscount Value) + : Discount2, + IVariant { - public static TrialDiscount From(Models::TrialDiscount value) + public static TrialDiscountVariant From(TrialDiscount value) { return new(value); } @@ -38,12 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class UsageDiscount(Models::UsageDiscount Value) - : Models::Discount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UsageDiscountVariant(UsageDiscount Value) + : Discount2, + IVariant { - public static UsageDiscount From(Models::UsageDiscount value) + public static UsageDiscountVariant From(UsageDiscount value) { return new(value); } @@ -54,14 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmountDiscount(Models::AmountDiscount Value) - : Models::Discount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmountDiscountVariant(AmountDiscount Value) + : Discount2, + IVariant { - public static AmountDiscount From(Models::AmountDiscount value) + public static AmountDiscountVariant From(AmountDiscount value) { return new(value); } diff --git a/src/Orb/Models/Events/Backfills/BackfillCloseParams.cs b/src/Orb/Models/Events/Backfills/BackfillCloseParams.cs index 8f77c0ca..29c86612 100644 --- a/src/Orb/Models/Events/Backfills/BackfillCloseParams.cs +++ b/src/Orb/Models/Events/Backfills/BackfillCloseParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Events.Backfills; @@ -10,13 +9,13 @@ namespace Orb.Models.Events.Backfills; /// graphs. Once all of the updates are complete, the backfill's status will transition /// to `reflected`. /// -public sealed record class BackfillCloseParams : Orb::ParamsBase +public sealed record class BackfillCloseParams : ParamsBase { public required string BackfillID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/events/backfills/{0}/close", this.BackfillID) ) @@ -25,12 +24,12 @@ public sealed record class BackfillCloseParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/Backfills/BackfillCloseResponse.cs b/src/Orb/Models/Events/Backfills/BackfillCloseResponse.cs index b42f1cdf..5d2da756 100644 --- a/src/Orb/Models/Events/Backfills/BackfillCloseResponse.cs +++ b/src/Orb/Models/Events/Backfills/BackfillCloseResponse.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BackfillCloseResponseProperties = Orb.Models.Events.Backfills.BackfillCloseResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Backfills; @@ -12,56 +11,48 @@ namespace Orb.Models.Events.Backfills; /// A backfill represents an update to historical usage data, adding or replacing /// events in a timeframe. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BackfillCloseResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BackfillCloseResponse : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// If in the future, the time at which the backfill will automatically close. /// If in the past, the time at which the backfill was closed. /// - public required System::DateTime? CloseTime + public required DateTime? CloseTime { get { - if (!this.Properties.TryGetValue("close_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "close_time", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("close_time", out JsonElement element)) + throw new ArgumentOutOfRangeException("close_time", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["close_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["close_time"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,15 +63,12 @@ public required string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,15 +78,15 @@ public required long EventsIngested { get { - if (!this.Properties.TryGetValue("events_ingested", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("events_ingested", out JsonElement element)) + throw new ArgumentOutOfRangeException( "events_ingested", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["events_ingested"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["events_ingested"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,43 +98,33 @@ public required bool ReplaceExistingEvents { get { - if ( - !this.Properties.TryGetValue( - "replace_existing_events", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replace_existing_events", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replace_existing_events", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replace_existing_events"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replace_existing_events"] = JsonSerializer.SerializeToElement(value); } } /// /// The time at which this backfill was reverted. /// - public required System::DateTime? RevertedAt + public required DateTime? RevertedAt { get { - if (!this.Properties.TryGetValue("reverted_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "reverted_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("reverted_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("reverted_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reverted_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reverted_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,47 +134,40 @@ public required bool ReplaceExistingEvents { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -207,15 +178,12 @@ public string? DeprecationFilter { get { - if (!this.Properties.TryGetValue("deprecation_filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("deprecation_filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["deprecation_filter"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["deprecation_filter"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -236,16 +204,14 @@ public override void Validate() public BackfillCloseResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BackfillCloseResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BackfillCloseResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BackfillCloseResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static BackfillCloseResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/Backfills/BackfillCloseResponseProperties/Status.cs b/src/Orb/Models/Events/Backfills/BackfillCloseResponseProperties/Status.cs index c1e5ff6a..1d7b04ee 100644 --- a/src/Orb/Models/Events/Backfills/BackfillCloseResponseProperties/Status.cs +++ b/src/Orb/Models/Events/Backfills/BackfillCloseResponseProperties/Status.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Events.Backfills.BackfillCloseResponseProperties; /// /// The status of the backfill. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -35,7 +34,7 @@ public Value Known() => "reflected" => Value.Reflected, "pending_revert" => Value.PendingRevert, "reverted" => Value.Reverted, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Events/Backfills/BackfillCreateParams.cs b/src/Orb/Models/Events/Backfills/BackfillCreateParams.cs index c4a0b9ef..2080be4b 100644 --- a/src/Orb/Models/Events/Backfills/BackfillCreateParams.cs +++ b/src/Orb/Models/Events/Backfills/BackfillCreateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Events.Backfills; @@ -41,31 +40,25 @@ namespace Orb.Models.Events.Backfills; /// of computed properties allows you to deprecate existing events based on both a /// period of time and specific property values. /// -public sealed record class BackfillCreateParams : Orb::ParamsBase +public sealed record class BackfillCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// The (exclusive) end of the usage timeframe affected by this backfill. By default, /// Orb allows backfills up to 31 days in duration at a time. Reach out to discuss /// extending this limit and your use case. /// - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.BodyProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,22 +66,19 @@ public sealed record class BackfillCreateParams : Orb::ParamsBase /// Orb allows backfills up to 31 days in duration at a time. Reach out to discuss /// extending this limit and your use case. /// - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.BodyProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.BodyProperties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -96,16 +86,16 @@ public sealed record class BackfillCreateParams : Orb::ParamsBase /// will automatically begin reflecting throughout Orb at the close time. If not /// specified, it will default to 1 day after the creation of the backfill. /// - public System::DateTime? CloseTime + public DateTime? CloseTime { get { - if (!this.BodyProperties.TryGetValue("close_time", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("close_time", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["close_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["close_time"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,12 +106,12 @@ public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -132,21 +122,14 @@ public string? DeprecationFilter { get { - if ( - !this.BodyProperties.TryGetValue( - "deprecation_filter", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("deprecation_filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["deprecation_filter"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["deprecation_filter"] = JsonSerializer.SerializeToElement(value); } } @@ -158,21 +141,14 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -185,45 +161,43 @@ public bool? ReplaceExistingEvents get { if ( - !this.BodyProperties.TryGetValue( - "replace_existing_events", - out Json::JsonElement element - ) + !this.BodyProperties.TryGetValue("replace_existing_events", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["replace_existing_events"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["replace_existing_events"] = JsonSerializer.SerializeToElement( + value + ); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/backfills") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/backfills") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/Backfills/BackfillCreateResponse.cs b/src/Orb/Models/Events/Backfills/BackfillCreateResponse.cs index a3b9b824..9697c9c0 100644 --- a/src/Orb/Models/Events/Backfills/BackfillCreateResponse.cs +++ b/src/Orb/Models/Events/Backfills/BackfillCreateResponse.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BackfillCreateResponseProperties = Orb.Models.Events.Backfills.BackfillCreateResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Backfills; @@ -12,56 +11,48 @@ namespace Orb.Models.Events.Backfills; /// A backfill represents an update to historical usage data, adding or replacing /// events in a timeframe. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BackfillCreateResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BackfillCreateResponse : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// If in the future, the time at which the backfill will automatically close. /// If in the past, the time at which the backfill was closed. /// - public required System::DateTime? CloseTime + public required DateTime? CloseTime { get { - if (!this.Properties.TryGetValue("close_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "close_time", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("close_time", out JsonElement element)) + throw new ArgumentOutOfRangeException("close_time", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["close_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["close_time"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,15 +63,12 @@ public required string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,15 +78,15 @@ public required long EventsIngested { get { - if (!this.Properties.TryGetValue("events_ingested", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("events_ingested", out JsonElement element)) + throw new ArgumentOutOfRangeException( "events_ingested", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["events_ingested"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["events_ingested"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,43 +98,33 @@ public required bool ReplaceExistingEvents { get { - if ( - !this.Properties.TryGetValue( - "replace_existing_events", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replace_existing_events", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replace_existing_events", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replace_existing_events"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replace_existing_events"] = JsonSerializer.SerializeToElement(value); } } /// /// The time at which this backfill was reverted. /// - public required System::DateTime? RevertedAt + public required DateTime? RevertedAt { get { - if (!this.Properties.TryGetValue("reverted_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "reverted_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("reverted_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("reverted_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reverted_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reverted_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,47 +134,40 @@ public required bool ReplaceExistingEvents { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -207,15 +178,12 @@ public string? DeprecationFilter { get { - if (!this.Properties.TryGetValue("deprecation_filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("deprecation_filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["deprecation_filter"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["deprecation_filter"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -236,15 +204,15 @@ public override void Validate() public BackfillCreateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BackfillCreateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BackfillCreateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BackfillCreateResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Events/Backfills/BackfillCreateResponseProperties/Status.cs b/src/Orb/Models/Events/Backfills/BackfillCreateResponseProperties/Status.cs index b463f1f1..cc29f584 100644 --- a/src/Orb/Models/Events/Backfills/BackfillCreateResponseProperties/Status.cs +++ b/src/Orb/Models/Events/Backfills/BackfillCreateResponseProperties/Status.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Events.Backfills.BackfillCreateResponseProperties; /// /// The status of the backfill. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -35,7 +34,7 @@ public Value Known() => "reflected" => Value.Reflected, "pending_revert" => Value.PendingRevert, "reverted" => Value.Reverted, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Events/Backfills/BackfillFetchParams.cs b/src/Orb/Models/Events/Backfills/BackfillFetchParams.cs index 3f7ef357..9128fc29 100644 --- a/src/Orb/Models/Events/Backfills/BackfillFetchParams.cs +++ b/src/Orb/Models/Events/Backfills/BackfillFetchParams.cs @@ -1,19 +1,18 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Events.Backfills; /// /// This endpoint is used to fetch a backfill given an identifier. /// -public sealed record class BackfillFetchParams : Orb::ParamsBase +public sealed record class BackfillFetchParams : ParamsBase { public required string BackfillID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/events/backfills/{0}", this.BackfillID) ) @@ -22,12 +21,12 @@ public sealed record class BackfillFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/Backfills/BackfillFetchResponse.cs b/src/Orb/Models/Events/Backfills/BackfillFetchResponse.cs index 64251444..6cb70af1 100644 --- a/src/Orb/Models/Events/Backfills/BackfillFetchResponse.cs +++ b/src/Orb/Models/Events/Backfills/BackfillFetchResponse.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BackfillFetchResponseProperties = Orb.Models.Events.Backfills.BackfillFetchResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Backfills; @@ -12,56 +11,48 @@ namespace Orb.Models.Events.Backfills; /// A backfill represents an update to historical usage data, adding or replacing /// events in a timeframe. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BackfillFetchResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BackfillFetchResponse : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// If in the future, the time at which the backfill will automatically close. /// If in the past, the time at which the backfill was closed. /// - public required System::DateTime? CloseTime + public required DateTime? CloseTime { get { - if (!this.Properties.TryGetValue("close_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "close_time", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("close_time", out JsonElement element)) + throw new ArgumentOutOfRangeException("close_time", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["close_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["close_time"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,15 +63,12 @@ public required string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,15 +78,15 @@ public required long EventsIngested { get { - if (!this.Properties.TryGetValue("events_ingested", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("events_ingested", out JsonElement element)) + throw new ArgumentOutOfRangeException( "events_ingested", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["events_ingested"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["events_ingested"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,43 +98,33 @@ public required bool ReplaceExistingEvents { get { - if ( - !this.Properties.TryGetValue( - "replace_existing_events", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replace_existing_events", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replace_existing_events", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replace_existing_events"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replace_existing_events"] = JsonSerializer.SerializeToElement(value); } } /// /// The time at which this backfill was reverted. /// - public required System::DateTime? RevertedAt + public required DateTime? RevertedAt { get { - if (!this.Properties.TryGetValue("reverted_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "reverted_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("reverted_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("reverted_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reverted_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reverted_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,47 +134,40 @@ public required bool ReplaceExistingEvents { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -207,15 +178,12 @@ public string? DeprecationFilter { get { - if (!this.Properties.TryGetValue("deprecation_filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("deprecation_filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["deprecation_filter"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["deprecation_filter"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -236,16 +204,14 @@ public override void Validate() public BackfillFetchResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BackfillFetchResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BackfillFetchResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BackfillFetchResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static BackfillFetchResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/Backfills/BackfillFetchResponseProperties/Status.cs b/src/Orb/Models/Events/Backfills/BackfillFetchResponseProperties/Status.cs index 539e668a..2ec9489c 100644 --- a/src/Orb/Models/Events/Backfills/BackfillFetchResponseProperties/Status.cs +++ b/src/Orb/Models/Events/Backfills/BackfillFetchResponseProperties/Status.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Events.Backfills.BackfillFetchResponseProperties; /// /// The status of the backfill. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -35,7 +34,7 @@ public Value Known() => "reflected" => Value.Reflected, "pending_revert" => Value.PendingRevert, "reverted" => Value.Reverted, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Events/Backfills/BackfillListPageResponse.cs b/src/Orb/Models/Events/Backfills/BackfillListPageResponse.cs index fea123ef..e547f15c 100644 --- a/src/Orb/Models/Events/Backfills/BackfillListPageResponse.cs +++ b/src/Orb/Models/Events/Backfills/BackfillListPageResponse.cs @@ -1,50 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BackfillListPageResponseProperties = Orb.Models.Events.Backfills.BackfillListPageResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Backfills; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BackfillListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BackfillListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element - ) ?? throw new System::ArgumentNullException("data"); + ) ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +53,15 @@ public override void Validate() public BackfillListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BackfillListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BackfillListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BackfillListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/Data.cs b/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/Data.cs index aa8e902c..cbfe1084 100644 --- a/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/Data.cs +++ b/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/Data.cs @@ -1,10 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Events.Backfills.BackfillListPageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Backfills.BackfillListPageResponseProperties; @@ -12,54 +11,48 @@ namespace Orb.Models.Events.Backfills.BackfillListPageResponseProperties; /// A backfill represents an update to historical usage data, adding or replacing /// events in a timeframe. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// If in the future, the time at which the backfill will automatically close. /// If in the past, the time at which the backfill was closed. /// - public required System::DateTime? CloseTime + public required DateTime? CloseTime { get { - if (!this.Properties.TryGetValue("close_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "close_time", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("close_time", out JsonElement element)) + throw new ArgumentOutOfRangeException("close_time", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["close_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["close_time"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -70,15 +63,12 @@ public required string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -88,15 +78,15 @@ public required long EventsIngested { get { - if (!this.Properties.TryGetValue("events_ingested", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("events_ingested", out JsonElement element)) + throw new ArgumentOutOfRangeException( "events_ingested", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["events_ingested"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["events_ingested"] = JsonSerializer.SerializeToElement(value); } } /// @@ -108,43 +98,33 @@ public required bool ReplaceExistingEvents { get { - if ( - !this.Properties.TryGetValue( - "replace_existing_events", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replace_existing_events", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replace_existing_events", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replace_existing_events"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replace_existing_events"] = JsonSerializer.SerializeToElement(value); } } /// /// The time at which this backfill was reverted. /// - public required System::DateTime? RevertedAt + public required DateTime? RevertedAt { get { - if (!this.Properties.TryGetValue("reverted_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "reverted_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("reverted_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("reverted_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reverted_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reverted_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,46 +134,40 @@ public required bool ReplaceExistingEvents { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -204,15 +178,12 @@ public string? DeprecationFilter { get { - if (!this.Properties.TryGetValue("deprecation_filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("deprecation_filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["deprecation_filter"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["deprecation_filter"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -233,14 +204,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/DataProperties/Status.cs b/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/DataProperties/Status.cs index 9ed52c83..24b8585a 100644 --- a/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/DataProperties/Status.cs +++ b/src/Orb/Models/Events/Backfills/BackfillListPageResponseProperties/DataProperties/Status.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Events.Backfills.BackfillListPageResponseProperties.DataProperties; /// /// The status of the backfill. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -35,7 +34,7 @@ public Value Known() => "reflected" => Value.Reflected, "pending_revert" => Value.PendingRevert, "reverted" => Value.Reverted, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Events/Backfills/BackfillListParams.cs b/src/Orb/Models/Events/Backfills/BackfillListParams.cs index 50a2e6e1..7a2a1caf 100644 --- a/src/Orb/Models/Events/Backfills/BackfillListParams.cs +++ b/src/Orb/Models/Events/Backfills/BackfillListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Events.Backfills; @@ -13,7 +12,7 @@ namespace Orb.Models.Events.Backfills; /// which lets the caller retrieve the next page of results if they exist. More information /// about pagination can be found in the [Pagination-metadata schema](pagination). /// -public sealed record class BackfillListParams : Orb::ParamsBase +public sealed record class BackfillListParams : ParamsBase { /// /// Cursor for pagination. This can be populated by the `next_cursor` value returned @@ -23,12 +22,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,28 +37,28 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/backfills") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/backfills") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/Backfills/BackfillRevertParams.cs b/src/Orb/Models/Events/Backfills/BackfillRevertParams.cs index 3117b17f..f58f5ebc 100644 --- a/src/Orb/Models/Events/Backfills/BackfillRevertParams.cs +++ b/src/Orb/Models/Events/Backfills/BackfillRevertParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Events.Backfills; @@ -13,13 +12,13 @@ namespace Orb.Models.Events.Backfills; /// If a backfill is reverted before its closed, no usage will be updated as a result /// of the backfill and it will immediately transition to `reverted`. /// -public sealed record class BackfillRevertParams : Orb::ParamsBase +public sealed record class BackfillRevertParams : ParamsBase { public required string BackfillID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/events/backfills/{0}/revert", this.BackfillID) ) @@ -28,12 +27,12 @@ public sealed record class BackfillRevertParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/Backfills/BackfillRevertResponse.cs b/src/Orb/Models/Events/Backfills/BackfillRevertResponse.cs index 051c9547..ba35d1b2 100644 --- a/src/Orb/Models/Events/Backfills/BackfillRevertResponse.cs +++ b/src/Orb/Models/Events/Backfills/BackfillRevertResponse.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BackfillRevertResponseProperties = Orb.Models.Events.Backfills.BackfillRevertResponseProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Backfills; @@ -12,56 +11,48 @@ namespace Orb.Models.Events.Backfills; /// A backfill represents an update to historical usage data, adding or replacing /// events in a timeframe. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BackfillRevertResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BackfillRevertResponse : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// If in the future, the time at which the backfill will automatically close. /// If in the past, the time at which the backfill was closed. /// - public required System::DateTime? CloseTime + public required DateTime? CloseTime { get { - if (!this.Properties.TryGetValue("close_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "close_time", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("close_time", out JsonElement element)) + throw new ArgumentOutOfRangeException("close_time", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["close_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["close_time"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,15 +63,12 @@ public required string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,15 +78,15 @@ public required long EventsIngested { get { - if (!this.Properties.TryGetValue("events_ingested", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("events_ingested", out JsonElement element)) + throw new ArgumentOutOfRangeException( "events_ingested", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["events_ingested"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["events_ingested"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,43 +98,33 @@ public required bool ReplaceExistingEvents { get { - if ( - !this.Properties.TryGetValue( - "replace_existing_events", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replace_existing_events", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replace_existing_events", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replace_existing_events"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replace_existing_events"] = JsonSerializer.SerializeToElement(value); } } /// /// The time at which this backfill was reverted. /// - public required System::DateTime? RevertedAt + public required DateTime? RevertedAt { get { - if (!this.Properties.TryGetValue("reverted_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "reverted_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("reverted_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("reverted_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reverted_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reverted_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,47 +134,40 @@ public required bool ReplaceExistingEvents { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -207,15 +178,12 @@ public string? DeprecationFilter { get { - if (!this.Properties.TryGetValue("deprecation_filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("deprecation_filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["deprecation_filter"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["deprecation_filter"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -236,15 +204,15 @@ public override void Validate() public BackfillRevertResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BackfillRevertResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + BackfillRevertResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static BackfillRevertResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Events/Backfills/BackfillRevertResponseProperties/Status.cs b/src/Orb/Models/Events/Backfills/BackfillRevertResponseProperties/Status.cs index d2accf2f..e5751cb8 100644 --- a/src/Orb/Models/Events/Backfills/BackfillRevertResponseProperties/Status.cs +++ b/src/Orb/Models/Events/Backfills/BackfillRevertResponseProperties/Status.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Events.Backfills.BackfillRevertResponseProperties; /// /// The status of the backfill. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -35,7 +34,7 @@ public Value Known() => "reflected" => Value.Reflected, "pending_revert" => Value.PendingRevert, "reverted" => Value.Reverted, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Events/EventDeprecateParams.cs b/src/Orb/Models/Events/EventDeprecateParams.cs index 3036aca7..6b43649f 100644 --- a/src/Orb/Models/Events/EventDeprecateParams.cs +++ b/src/Orb/Models/Events/EventDeprecateParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Events; @@ -38,13 +37,13 @@ namespace Orb.Models.Events; /// can be deprecated for a single customer in a 100 day period. For higher volume /// updates, consider using the [event backfill](create-backfill) endpoint. /// -public sealed record class EventDeprecateParams : Orb::ParamsBase +public sealed record class EventDeprecateParams : ParamsBase { public required string EventID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/events/{0}/deprecate", this.EventID) ) @@ -53,12 +52,12 @@ public sealed record class EventDeprecateParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/EventDeprecateResponse.cs b/src/Orb/Models/Events/EventDeprecateResponse.cs index 9341cdbe..c86212af 100644 --- a/src/Orb/Models/Events/EventDeprecateResponse.cs +++ b/src/Orb/Models/Events/EventDeprecateResponse.cs @@ -1,16 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EventDeprecateResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EventDeprecateResponse : ModelBase, IFromRaw { /// /// event_id of the deprecated event, if successfully updated @@ -19,16 +16,13 @@ public required string Deprecated { get { - if (!this.Properties.TryGetValue("deprecated", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "deprecated", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("deprecated", out JsonElement element)) + throw new ArgumentOutOfRangeException("deprecated", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("deprecated"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("deprecated"); } - set { this.Properties["deprecated"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["deprecated"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -39,15 +33,15 @@ public override void Validate() public EventDeprecateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EventDeprecateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + EventDeprecateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static EventDeprecateResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Events/EventIngestParams.cs b/src/Orb/Models/Events/EventIngestParams.cs index ee596621..3aca3559 100644 --- a/src/Orb/Models/Events/EventIngestParams.cs +++ b/src/Orb/Models/Events/EventIngestParams.cs @@ -1,10 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using EventIngestParamsProperties = Orb.Models.Events.EventIngestParamsProperties; -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; namespace Orb.Models.Events; @@ -172,25 +171,21 @@ namespace Orb.Models.Events; /// /// ```json { "validation_failed": [] } ``` /// -public sealed record class EventIngestParams : Orb::ParamsBase +public sealed record class EventIngestParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; - public required Generic::List Events + public required List Events { get { - if (!this.BodyProperties.TryGetValue("events", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "events", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("events", out JsonElement element)) + throw new ArgumentOutOfRangeException("events", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("events"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("events"); } - set { this.BodyProperties["events"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["events"] = JsonSerializer.SerializeToElement(value); } } /// @@ -201,15 +196,12 @@ public string? BackfillID { get { - if (!this.QueryProperties.TryGetValue("backfill_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("backfill_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["backfill_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["backfill_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -219,37 +211,37 @@ public bool? Debug { get { - if (!this.QueryProperties.TryGetValue("debug", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("debug", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["debug"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["debug"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/ingest") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/ingest") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/EventIngestParamsProperties/Event.cs b/src/Orb/Models/Events/EventIngestParamsProperties/Event.cs index 19a7181f..86900206 100644 --- a/src/Orb/Models/Events/EventIngestParamsProperties/Event.cs +++ b/src/Orb/Models/Events/EventIngestParamsProperties/Event.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events.EventIngestParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Event : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Event : ModelBase, IFromRaw { /// /// A name to meaningfully identify the action or event type. @@ -17,16 +16,13 @@ public required string EventName { get { - if (!this.Properties.TryGetValue("event_name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "event_name", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("event_name", out JsonElement element)) + throw new ArgumentOutOfRangeException("event_name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("event_name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("event_name"); } - set { this.Properties["event_name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["event_name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,37 +34,33 @@ public required string IdempotencyKey { get { - if (!this.Properties.TryGetValue("idempotency_key", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("idempotency_key", out JsonElement element)) + throw new ArgumentOutOfRangeException( "idempotency_key", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("idempotency_key"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("idempotency_key"); } - set { this.Properties["idempotency_key"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["idempotency_key"] = JsonSerializer.SerializeToElement(value); } } /// /// A dictionary of custom properties. Values in this dictionary must be numeric, /// boolean, or strings. Nested dictionaries are disallowed. /// - public required Generic::Dictionary Properties1 + public required Dictionary Properties1 { get { - if (!this.Properties.TryGetValue("properties", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "properties", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("properties", out JsonElement element)) + throw new ArgumentOutOfRangeException("properties", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("properties"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("properties"); } - set { this.Properties["properties"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["properties"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,19 +68,16 @@ public required string IdempotencyKey /// the time that usage was recorded, and is particularly important to attribute /// usage to a given billing period. /// - public required System::DateTime Timestamp + public required DateTime Timestamp { get { - if (!this.Properties.TryGetValue("timestamp", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timestamp", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timestamp", out JsonElement element)) + throw new ArgumentOutOfRangeException("timestamp", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timestamp"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timestamp"] = JsonSerializer.SerializeToElement(value); } } /// @@ -98,12 +87,12 @@ public string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -113,17 +102,12 @@ public string? ExternalCustomerID { get { - if (!this.Properties.TryGetValue("external_customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -142,14 +126,14 @@ public override void Validate() public Event() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Event(Generic::Dictionary properties) + [SetsRequiredMembers] + Event(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Event FromRawUnchecked(Generic::Dictionary properties) + public static Event FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/EventIngestResponse.cs b/src/Orb/Models/Events/EventIngestResponse.cs index ebfd9bd4..7e25f86c 100644 --- a/src/Orb/Models/Events/EventIngestResponse.cs +++ b/src/Orb/Models/Events/EventIngestResponse.cs @@ -1,38 +1,34 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using EventIngestResponseProperties = Orb.Models.Events.EventIngestResponseProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EventIngestResponse : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EventIngestResponse : ModelBase, IFromRaw { /// /// Contains all failing validation events. In the case of a 200, this array will /// always be empty. This field will always be present. /// - public required Generic::List ValidationFailed + public required List ValidationFailed { get { - if (!this.Properties.TryGetValue("validation_failed", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("validation_failed", out JsonElement element)) + throw new ArgumentOutOfRangeException( "validation_failed", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("validation_failed"); - } - set - { - this.Properties["validation_failed"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new ArgumentNullException("validation_failed"); } + set { this.Properties["validation_failed"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,12 +39,12 @@ public sealed record class EventIngestResponse : Orb::ModelBase, Orb::IFromRaw(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["debug"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["debug"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -63,16 +59,14 @@ public override void Validate() public EventIngestResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EventIngestResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + EventIngestResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static EventIngestResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static EventIngestResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/EventIngestResponseProperties/Debug.cs b/src/Orb/Models/Events/EventIngestResponseProperties/Debug.cs index 318a5526..c8f7a700 100644 --- a/src/Orb/Models/Events/EventIngestResponseProperties/Debug.cs +++ b/src/Orb/Models/Events/EventIngestResponseProperties/Debug.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events.EventIngestResponseProperties; @@ -11,39 +10,33 @@ namespace Orb.Models.Events.EventIngestResponseProperties; /// Optional debug information (only present when debug=true is passed to the endpoint). /// Contains ingested and duplicate event idempotency keys. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Debug : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Debug : ModelBase, IFromRaw { - public required Generic::List Duplicate + public required List Duplicate { get { - if (!this.Properties.TryGetValue("duplicate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "duplicate", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("duplicate", out JsonElement element)) + throw new ArgumentOutOfRangeException("duplicate", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("duplicate"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("duplicate"); } - set { this.Properties["duplicate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duplicate"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List Ingested + public required List Ingested { get { - if (!this.Properties.TryGetValue("ingested", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "ingested", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("ingested", out JsonElement element)) + throw new ArgumentOutOfRangeException("ingested", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("ingested"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("ingested"); } - set { this.Properties["ingested"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ingested"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -61,14 +54,14 @@ public override void Validate() public Debug() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Debug(Generic::Dictionary properties) + [SetsRequiredMembers] + Debug(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Debug FromRawUnchecked(Generic::Dictionary properties) + public static Debug FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/EventIngestResponseProperties/ValidationFailed.cs b/src/Orb/Models/Events/EventIngestResponseProperties/ValidationFailed.cs index e7ce476c..142550b3 100644 --- a/src/Orb/Models/Events/EventIngestResponseProperties/ValidationFailed.cs +++ b/src/Orb/Models/Events/EventIngestResponseProperties/ValidationFailed.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events.EventIngestResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ValidationFailed : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ValidationFailed : ModelBase, IFromRaw { /// /// The passed idempotency_key corresponding to the validation_errors @@ -17,38 +16,35 @@ public required string IdempotencyKey { get { - if (!this.Properties.TryGetValue("idempotency_key", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("idempotency_key", out JsonElement element)) + throw new ArgumentOutOfRangeException( "idempotency_key", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("idempotency_key"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("idempotency_key"); } - set { this.Properties["idempotency_key"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["idempotency_key"] = JsonSerializer.SerializeToElement(value); } } /// /// An array of strings corresponding to validation failures for this idempotency_key. /// - public required Generic::List ValidationErrors + public required List ValidationErrors { get { - if (!this.Properties.TryGetValue("validation_errors", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("validation_errors", out JsonElement element)) + throw new ArgumentOutOfRangeException( "validation_errors", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("validation_errors"); - } - set - { - this.Properties["validation_errors"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("validation_errors"); } + set { this.Properties["validation_errors"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -63,16 +59,14 @@ public override void Validate() public ValidationFailed() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ValidationFailed(Generic::Dictionary properties) + [SetsRequiredMembers] + ValidationFailed(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ValidationFailed FromRawUnchecked( - Generic::Dictionary properties - ) + public static ValidationFailed FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/EventSearchParams.cs b/src/Orb/Models/Events/EventSearchParams.cs index 88c0d0f1..87491772 100644 --- a/src/Orb/Models/Events/EventSearchParams.cs +++ b/src/Orb/Models/Events/EventSearchParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Events; @@ -22,92 +21,83 @@ namespace Orb.Models.Events; /// By default, Orb will not throw a `404` if no events matched, Orb will return /// an empty array for `data` instead. /// -public sealed record class EventSearchParams : Orb::ParamsBase +public sealed record class EventSearchParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// This is an explicit array of IDs to filter by. Note that an event's ID is the /// idempotency_key that was originally used for ingestion, and this only supports /// events that have not been amended. Values in this array will be treated case sensitively. /// - public required Generic::List EventIDs + public required List EventIDs { get { - if (!this.BodyProperties.TryGetValue("event_ids", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "event_ids", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("event_ids", out JsonElement element)) + throw new ArgumentOutOfRangeException("event_ids", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("event_ids"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("event_ids"); } - set { this.BodyProperties["event_ids"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["event_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The end of the timeframe, exclusive, in which to search events. If not specified, /// the current time is used. /// - public System::DateTime? TimeframeEnd + public DateTime? TimeframeEnd { get { - if (!this.BodyProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_end", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// /// The start of the timeframe, inclusive, in which to search events. If not specified, /// the one week ago is used. /// - public System::DateTime? TimeframeStart + public DateTime? TimeframeStart { get { - if (!this.BodyProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_start", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/search") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/search") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/EventSearchResponse.cs b/src/Orb/Models/Events/EventSearchResponse.cs index d3e183f7..10ec3d36 100644 --- a/src/Orb/Models/Events/EventSearchResponse.cs +++ b/src/Orb/Models/Events/EventSearchResponse.cs @@ -1,28 +1,26 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using EventSearchResponseProperties = Orb.Models.Events.EventSearchResponseProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EventSearchResponse : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EventSearchResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -36,16 +34,14 @@ public override void Validate() public EventSearchResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EventSearchResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + EventSearchResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static EventSearchResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static EventSearchResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/EventSearchResponseProperties/Data.cs b/src/Orb/Models/Events/EventSearchResponseProperties/Data.cs index 7fc37eb4..a3877597 100644 --- a/src/Orb/Models/Events/EventSearchResponseProperties/Data.cs +++ b/src/Orb/Models/Events/EventSearchResponseProperties/Data.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events.EventSearchResponseProperties; @@ -12,8 +11,8 @@ namespace Orb.Models.Events.EventSearchResponseProperties; /// been created for a customer. Events are the core of Orb's usage-based billing /// model, and are used to calculate the usage charges for a given billing period. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { /// /// A unique value, generated by the client, that is used to de-duplicate events. @@ -24,13 +23,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,15 +39,12 @@ public required string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -58,15 +54,12 @@ public required bool Deprecated { get { - if (!this.Properties.TryGetValue("deprecated", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "deprecated", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("deprecated", out JsonElement element)) + throw new ArgumentOutOfRangeException("deprecated", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["deprecated"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["deprecated"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,16 +69,13 @@ public required string EventName { get { - if (!this.Properties.TryGetValue("event_name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "event_name", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("event_name", out JsonElement element)) + throw new ArgumentOutOfRangeException("event_name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("event_name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("event_name"); } - set { this.Properties["event_name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["event_name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,41 +85,32 @@ public required string? ExternalCustomerID { get { - if (!this.Properties.TryGetValue("external_customer_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_customer_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_customer_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } /// /// A dictionary of custom properties. Values in this dictionary must be numeric, /// boolean, or strings. Nested dictionaries are disallowed. /// - public required Generic::Dictionary Properties1 + public required Dictionary Properties1 { get { - if (!this.Properties.TryGetValue("properties", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "properties", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("properties", out JsonElement element)) + throw new ArgumentOutOfRangeException("properties", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("properties"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("properties"); } - set { this.Properties["properties"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["properties"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,19 +118,16 @@ public required string? ExternalCustomerID /// the time that usage was recorded, and is particularly important to attribute /// usage to a given billing period. /// - public required System::DateTime Timestamp + public required DateTime Timestamp { get { - if (!this.Properties.TryGetValue("timestamp", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timestamp", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timestamp", out JsonElement element)) + throw new ArgumentOutOfRangeException("timestamp", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timestamp"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timestamp"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -169,14 +147,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/EventUpdateParams.cs b/src/Orb/Models/Events/EventUpdateParams.cs index 3612b8cf..2333e88d 100644 --- a/src/Orb/Models/Events/EventUpdateParams.cs +++ b/src/Orb/Models/Events/EventUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Events; @@ -45,9 +44,9 @@ namespace Orb.Models.Events; /// for a single customer in a 100 day period. For higher volume updates, consider /// using the [event backfill](create-backfill) endpoint. /// -public sealed record class EventUpdateParams : Orb::ParamsBase +public sealed record class EventUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string EventID; @@ -58,37 +57,30 @@ public required string EventName { get { - if (!this.BodyProperties.TryGetValue("event_name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "event_name", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("event_name"); + if (!this.BodyProperties.TryGetValue("event_name", out JsonElement element)) + throw new ArgumentOutOfRangeException("event_name", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("event_name"); } - set { this.BodyProperties["event_name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["event_name"] = JsonSerializer.SerializeToElement(value); } } /// /// A dictionary of custom properties. Values in this dictionary must be numeric, /// boolean, or strings. Nested dictionaries are disallowed. /// - public required Generic::Dictionary Properties + public required Dictionary Properties { get { - if (!this.BodyProperties.TryGetValue("properties", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "properties", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("properties"); + if (!this.BodyProperties.TryGetValue("properties", out JsonElement element)) + throw new ArgumentOutOfRangeException("properties", "Missing required argument"); + + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("properties"); } - set { this.BodyProperties["properties"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["properties"] = JsonSerializer.SerializeToElement(value); } } /// @@ -96,19 +88,16 @@ public required string EventName /// the time that usage was recorded, and is particularly important to attribute /// usage to a given billing period. /// - public required System::DateTime Timestamp + public required DateTime Timestamp { get { - if (!this.BodyProperties.TryGetValue("timestamp", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timestamp", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("timestamp", out JsonElement element)) + throw new ArgumentOutOfRangeException("timestamp", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["timestamp"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["timestamp"] = JsonSerializer.SerializeToElement(value); } } /// @@ -118,12 +107,12 @@ public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -133,27 +122,20 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/events/{0}", this.EventID) ) { @@ -161,21 +143,21 @@ public string? ExternalCustomerID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Events/EventUpdateResponse.cs b/src/Orb/Models/Events/EventUpdateResponse.cs index 5c60c79a..8b444b09 100644 --- a/src/Orb/Models/Events/EventUpdateResponse.cs +++ b/src/Orb/Models/Events/EventUpdateResponse.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EventUpdateResponse : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EventUpdateResponse : ModelBase, IFromRaw { /// /// event_id of the amended event, if successfully ingested @@ -17,16 +16,13 @@ public required string Amended { get { - if (!this.Properties.TryGetValue("amended", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amended", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amended", out JsonElement element)) + throw new ArgumentOutOfRangeException("amended", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amended"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amended"); } - set { this.Properties["amended"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amended"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +33,14 @@ public override void Validate() public EventUpdateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EventUpdateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + EventUpdateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static EventUpdateResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static EventUpdateResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/Volume/EventVolumes.cs b/src/Orb/Models/Events/Volume/EventVolumes.cs index cacea236..e236d2e6 100644 --- a/src/Orb/Models/Events/Volume/EventVolumes.cs +++ b/src/Orb/Models/Events/Volume/EventVolumes.cs @@ -1,28 +1,26 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using EventVolumesProperties = Orb.Models.Events.Volume.EventVolumesProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Events.Volume; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EventVolumes : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EventVolumes : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -36,16 +34,14 @@ public override void Validate() public EventVolumes() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EventVolumes(Generic::Dictionary properties) + [SetsRequiredMembers] + EventVolumes(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static EventVolumes FromRawUnchecked( - Generic::Dictionary properties - ) + public static EventVolumes FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/Volume/EventVolumesProperties/Data.cs b/src/Orb/Models/Events/Volume/EventVolumesProperties/Data.cs index a0392b4d..954145b5 100644 --- a/src/Orb/Models/Events/Volume/EventVolumesProperties/Data.cs +++ b/src/Orb/Models/Events/Volume/EventVolumesProperties/Data.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Events.Volume.EventVolumesProperties; @@ -11,8 +10,8 @@ namespace Orb.Models.Events.Volume.EventVolumesProperties; /// An EventVolume contains the event volume ingested in an hourly window. The timestamp /// used for the aggregation is the `timestamp` datetime field on events. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { /// /// The number of events ingested with a timestamp between the timeframe @@ -21,42 +20,39 @@ public required long Count { get { - if (!this.Properties.TryGetValue("count", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("count", "Missing required argument"); + if (!this.Properties.TryGetValue("count", out JsonElement element)) + throw new ArgumentOutOfRangeException("count", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["count"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["count"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -69,14 +65,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Events/Volume/VolumeListParams.cs b/src/Orb/Models/Events/Volume/VolumeListParams.cs index 192a03ed..e23c0f2d 100644 --- a/src/Orb/Models/Events/Volume/VolumeListParams.cs +++ b/src/Orb/Models/Events/Volume/VolumeListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Events.Volume; @@ -18,31 +17,26 @@ namespace Orb.Models.Events.Volume; /// is passed in for either start or end time, the response includes the hours the /// timestamp falls in. /// -public sealed record class VolumeListParams : Orb::ParamsBase +public sealed record class VolumeListParams : ParamsBase { /// /// The start of the timeframe, inclusive, in which to return event volume. All /// datetime values are converted to UTC time. If the specified time isn't hour-aligned, /// the response includes the event volume count for the hour the time falls in. /// - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.QueryProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.QueryProperties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,12 +47,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -68,12 +62,12 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } /// @@ -82,35 +76,32 @@ public long? Limit /// time.If the specified time isn't hour-aligned, the response includes the event /// volumecount for the hour the time falls in. /// - public System::DateTime? TimeframeEnd + public DateTime? TimeframeEnd { get { - if (!this.QueryProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_end", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/volume") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/events/volume") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/FixedFeeQuantityScheduleEntry.cs b/src/Orb/Models/FixedFeeQuantityScheduleEntry.cs index b69f5b65..b4462b38 100644 --- a/src/Orb/Models/FixedFeeQuantityScheduleEntry.cs +++ b/src/Orb/Models/FixedFeeQuantityScheduleEntry.cs @@ -1,76 +1,75 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class FixedFeeQuantityScheduleEntry - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required System::DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } public required string PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price_id"); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -84,15 +83,15 @@ public override void Validate() public FixedFeeQuantityScheduleEntry() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - FixedFeeQuantityScheduleEntry(Generic::Dictionary properties) + [SetsRequiredMembers] + FixedFeeQuantityScheduleEntry(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static FixedFeeQuantityScheduleEntry FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/FixedFeeQuantityTransition.cs b/src/Orb/Models/FixedFeeQuantityTransition.cs index f78a2f05..412c3892 100644 --- a/src/Orb/Models/FixedFeeQuantityTransition.cs +++ b/src/Orb/Models/FixedFeeQuantityTransition.cs @@ -1,61 +1,60 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class FixedFeeQuantityTransition - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required System::DateTime EffectiveDate { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "effective_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } public required string PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price_id"); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public required long Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -68,15 +67,15 @@ public override void Validate() public FixedFeeQuantityTransition() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - FixedFeeQuantityTransition(Generic::Dictionary properties) + [SetsRequiredMembers] + FixedFeeQuantityTransition(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static FixedFeeQuantityTransition FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Invoice.cs b/src/Orb/Models/Invoice.cs index e0339473..a65b12fc 100644 --- a/src/Orb/Models/Invoice.cs +++ b/src/Orb/Models/Invoice.cs @@ -1,9 +1,8 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using InvoiceProperties = Orb.Models.InvoiceProperties; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; @@ -15,20 +14,20 @@ namespace Orb.Models; /// fixed recurring fees or usage-based fees. They are generated at the end of a billing /// period, or as the result of an action, such as a cancellation. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Invoice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Invoice : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -39,47 +38,47 @@ public required string AmountDue { get { - if (!this.Properties.TryGetValue("amount_due", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_due", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_due", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_due"); } - set { this.Properties["amount_due"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_due"] = JsonSerializer.SerializeToElement(value); } } public required InvoiceProperties::AutoCollection AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("auto_collection"); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public required Address? BillingAddress { get { - if (!this.Properties.TryGetValue("billing_address", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billing_address", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "billing_address", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billing_address"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billing_address"] = JsonSerializer.SerializeToElement(value); } } /// @@ -89,35 +88,34 @@ public required Address? BillingAddress { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of credit notes associated with the invoice /// - public required Generic::List CreditNotes + public required List CreditNotes { get { - if (!this.Properties.TryGetValue("credit_notes", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_notes", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_notes", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("credit_notes"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("credit_notes"); } - set { this.Properties["credit_notes"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_notes"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,42 +125,42 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } public required CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List CustomerBalanceTransactions + public required List CustomerBalanceTransactions { get { if ( !this.Properties.TryGetValue( "customer_balance_transactions", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -170,14 +168,15 @@ public required CustomerMinified Customer "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element ) ?? throw new System::ArgumentNullException("customer_balance_transactions"); } set { - this.Properties["customer_balance_transactions"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["customer_balance_transactions"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -187,125 +186,116 @@ public required CustomerMinified Customer /// /// ### Supported Tax ID Countries and Types /// - /// | Country | Type | Description - /// | |----------------|--------------|---------------------------------------------| - /// | Andorra | `ad_nrt` | Andorran NRT Number - /// | | Argentina | `ar_cuit` | Argentinian Tax ID Number - /// | | Australia | `au_abn` | Australian Business Number (AU ABN) - /// | | Australia | `au_arn` | Australian Taxation Office - /// Reference Number | | Austria | `eu_vat` | European VAT Number - /// | | Bahrain | `bh_vat` | Bahraini VAT Number - /// | | Belgium | `eu_vat` | European VAT Number - /// | | Bolivia | `bo_tin` | Bolivian Tax ID - /// | | Brazil | `br_cnpj` | Brazilian CNPJ - /// Number | | Brazil | `br_cpf` | Brazilian CPF - /// Number | | Bulgaria | `bg_uic` | Bulgaria - /// Unified Identification Code | | Bulgaria | `eu_vat` | European - /// VAT Number | | Canada | `ca_bn` | Canadian - /// BN | | Canada | `ca_gst_hst` | Canadian - /// GST/HST Number | | Canada | `ca_pst_bc` | Canadian - /// PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian - /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian - /// PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian - /// QST Number (Québec) | | Chile | `cl_tin` | Chilean - /// TIN | | China | `cn_tin` | Chinese - /// Tax ID | | Colombia | `co_nit` | Colombian - /// NIT Number | | Costa Rica | `cr_tin` | Costa - /// Rican Tax ID | | Croatia | `eu_vat` | European - /// VAT Number | | Cyprus | `eu_vat` | European - /// VAT Number | | Czech Republic | `eu_vat` | European - /// VAT Number | | Denmark | `eu_vat` | European - /// VAT Number | | Dominican Republic | `do_rcn` | Dominican - /// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian - /// RUC Number | | Egypt | `eg_tin` | Egyptian - /// Tax Identification Number | | El Salvador | `sv_nit` - /// | El Salvadorian NIT Number | | Estonia | `eu_vat` | - /// European VAT Number | | EU | `eu_oss_vat` | European One Stop Shop - /// VAT Number for non-Union scheme | | Finland | `eu_vat` | European VAT - /// Number | | France | `eu_vat` | European - /// VAT Number | | Georgia | `ge_vat` | - /// Georgian VAT | | Germany | `eu_vat` - /// | European VAT Number | | Greece - /// | `eu_vat` | European VAT Number | | - /// Hong Kong | `hk_br` | Hong Kong BR Number - /// | | Hungary | `eu_vat` | European VAT Number - /// | | Hungary | `hu_tin` | Hungary Tax Number (adószám) - /// | | Iceland | `is_vat` | Icelandic VAT - /// | | India | `in_gst` | Indian GST - /// Number | | Indonesia | `id_npwp` | Indonesian - /// NPWP Number | | Ireland | `eu_vat` | - /// European VAT Number | | Israel | `il_vat` - /// | Israel VAT | | Italy - /// | `eu_vat` | European VAT Number | | - /// Japan | `jp_cn` | Japanese Corporate Number (*Hōjin Bangō*) - /// | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' - /// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | - /// Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) - /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification - /// Number | | Kenya | `ke_pin` | Kenya Revenue Authority - /// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number - /// | | Liechtenstein | `li_uid` | Liechtensteinian - /// UID Number | | Lithuania | `eu_vat` | European VAT Number - /// | | Luxembourg | `eu_vat` | European VAT Number - /// | | Malaysia | `my_frp` | Malaysian FRP Number - /// | | Malaysia | `my_itn` | Malaysian ITN - /// | | Malaysia | `my_sst` | Malaysian SST Number | - /// | Malta | `eu_vat ` | European VAT Number | | Mexico - /// | `mx_rfc` | Mexican RFC Number | | Netherlands - /// | `eu_vat` | European VAT Number | | New Zealand | - /// `nz_gst` | New Zealand GST Number | | Nigeria | - /// `ng_tin` | Nigerian Tax Identification Number | | Norway | `no_vat` - /// | Norwegian VAT Number | | Norway | `no_voec` | Norwegian - /// VAT on e-commerce Number | | Oman | `om_vat` | Omani VAT Number - /// | | Peru | `pe_ruc` | Peruvian RUC Number - /// | | Philippines | `ph_tin ` | Philippines Tax Identification - /// Number | | Poland | `eu_vat` | European VAT Number - /// | | Portugal | `eu_vat` | European VAT Number | | - /// Romania | `eu_vat` | European VAT Number | | Romania - /// | `ro_tin` | Romanian Tax ID Number | | Russia - /// | `ru_inn` | Russian INN | | Russia | `ru_kpp` - /// | Russian KPP | | Saudi Arabia | `sa_vat` | Saudi - /// Arabia VAT | | Serbia | `rs_pib` | Serbian PIB - /// Number | | Singapore | `sg_gst` | Singaporean GST - /// | | Singapore | `sg_uen` | Singaporean UEN - /// | | Slovakia | `eu_vat` | European VAT Number - /// | | Slovenia | `eu_vat` | European VAT Number - /// | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) - /// | | South Africa | `za_vat` | South African VAT - /// Number | | South Korea | `kr_brn` | Korean - /// BRN | | Spain | `es_cif` - /// | Spanish NIF Number (previously Spanish CIF Number) | | Spain - /// | `eu_vat` | European VAT Number | | - /// Sweden | `eu_vat` | European VAT Number - /// | | Switzerland | `ch_vat` | Switzerland VAT Number - /// | | Taiwan | `tw_vat` | Taiwanese VAT - /// | | Thailand | `th_vat` | - /// Thai VAT | | Turkey - /// | `tr_tin` | Turkish Tax Identification Number | | Ukraine - /// | `ua_vat` | Ukrainian VAT - /// | | United Arab Emirates | `ae_trn` | United Arab Emirates TRN - /// | | United Kingdom | `eu_vat` | Northern Ireland - /// VAT Number | | United Kingdom | `gb_vat` | United - /// Kingdom VAT Number | | United States | `us_ein` - /// | United States EIN | | Uruguay - /// | `uy_ruc` | Uruguayan RUC Number | | Venezuela - /// | `ve_rif` | Venezuelan RIF Number - /// | | Vietnam | `vn_tin` | Vietnamese Tax ID Number - /// | + /// | Country | Type | Description | |---------|------|-------------| | Albania + /// | `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran + /// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina + /// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax + /// Identification Number | | Aruba | `aw_tin` | Aruba Tax Identification Number + /// | | Australia | `au_abn` | Australian Business Number (AU ABN) | | Australia + /// | `au_arn` | Australian Taxation Office Reference Number | | Austria | `eu_vat` + /// | European VAT Number | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification + /// Number | | Bahamas | `bs_tin` | Bahamas Tax Identification Number | | Bahrain + /// | `bh_vat` | Bahraini VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business + /// Identification Number | | Barbados | `bb_tin` | Barbados Tax Identification + /// Number | | Belarus | `by_tin` | Belarus TIN Number | | Belgium | `eu_vat` | + /// European VAT Number | | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant + /// Fiscal Unique) | | Bolivia | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina + /// | `ba_tin` | Bosnia and Herzegovina Tax Identification Number | | Brazil | `br_cnpj` + /// | Brazilian CNPJ Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria + /// | `bg_uic` | Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | + /// European VAT Number | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification + /// Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia + /// Tax Identification Number | | Cameroon | `cm_niu` | Cameroon Tax Identification + /// Number (Numéro d'Identifiant fiscal Unique) | | Canada | `ca_bn` | Canadian + /// BN | | Canada | `ca_gst_hst` | Canadian GST/HST Number | | Canada | `ca_pst_bc` + /// | Canadian PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian + /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) + /// | | Canada | `ca_qst` | Canadian QST Number (Québec) | | Cape Verde | `cv_nif` + /// | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | + /// Chile | `cl_tin` | Chilean TIN | | China | `cn_tin` | Chinese Tax ID | | Colombia + /// | `co_nit` | Colombian NIT Number | | Congo-Kinshasa | `cd_nif` | Congo (DR) + /// Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | + /// `cr_tin` | Costa Rican Tax ID | | Croatia | `eu_vat` | European VAT Number | + /// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) | | Cyprus + /// | `eu_vat` | European VAT Number | | Czech Republic | `eu_vat` | European VAT + /// Number | | Denmark | `eu_vat` | European VAT Number | | Dominican Republic + /// | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` | Ecuadorian RUC Number + /// | | Egypt | `eg_tin` | Egyptian Tax Identification Number | | El Salvador | + /// `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` | European VAT + /// Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number | | European + /// Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme + /// | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European + /// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German + /// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | + /// Greece | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification + /// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong + /// BR Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` + /// | Hungary Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India + /// | `in_gst` | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP + /// Number | | Ireland | `eu_vat` | European VAT Number | | Israel | `il_vat` | + /// Israel VAT | | Italy | `eu_vat` | European VAT Number | | Japan | `jp_cn` | + /// Japanese Corporate Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered + /// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku + /// Bangō*) | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) + /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number | | + /// Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + /// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number | | Laos | `la_tin` + /// | Laos Tax Identification Number | | Latvia | `eu_vat` | European VAT Number + /// | | Liechtenstein | `li_uid` | Liechtensteinian UID Number | | Liechtenstein + /// | `li_vat` | Liechtenstein VAT Number | | Lithuania | `eu_vat` | European VAT + /// Number | | Luxembourg | `eu_vat` | European VAT Number | | Malaysia | `my_frp` + /// | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian ITN | | Malaysia + /// | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European VAT Number + /// | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de + /// Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova + /// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB + /// Number | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal + /// PAN Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand + /// | `nz_gst` | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification + /// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern + /// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian + /// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman + /// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | + /// Philippines | `ph_tin` | Philippines Tax Identification Number | | Poland | + /// `eu_vat` | European VAT Number | | Portugal | `eu_vat` | European VAT Number + /// | | Romania | `eu_vat` | European VAT Number | | Romania | `ro_tin` | Romanian + /// Tax ID Number | | Russia | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian + /// KPP | | Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` + /// | Senegal NINEA Number | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore + /// | `sg_gst` | Singaporean GST | | Singapore | `sg_uen` | Singaporean UEN | | + /// Slovakia | `eu_vat` | European VAT Number | | Slovenia | `eu_vat` | European + /// VAT Number | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) | + /// | South Africa | `za_vat` | South African VAT Number | | South Korea | `kr_brn` + /// | Korean BRN | | Spain | `es_cif` | Spanish NIF Number (previously Spanish + /// CIF Number) | | Spain | `eu_vat` | European VAT Number | | Suriname | `sr_fin` + /// | Suriname FIN Number | | Sweden | `eu_vat` | European VAT Number | | Switzerland + /// | `ch_uid` | Switzerland UID Number | | Switzerland | `ch_vat` | Switzerland + /// VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | Tajikistan | `tj_tin` + /// | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` | Tanzania VAT + /// Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` | Turkish Tax + /// Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification Number + /// | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` | + /// United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT + /// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` + /// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | + /// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | + /// Venezuelan RIF Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | + /// Zambia | `zm_tin` | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` + /// | Zimbabwe Tax Identification Number | /// public required CustomerTaxID? CustomerTaxID { get { - if (!this.Properties.TryGetValue("customer_tax_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer_tax_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer_tax_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_tax_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_tax_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -313,35 +303,35 @@ public required CustomerTaxID? CustomerTaxID /// provided, the first discount in the list will be returned. If the list is empty, /// `None` will be returned. /// - public required Json::JsonElement Discount + public required JsonElement Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List Discounts + public required List Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discounts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("discounts"); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -352,15 +342,15 @@ public required CustomerTaxID? CustomerTaxID { get { - if (!this.Properties.TryGetValue("due_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("due_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "due_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["due_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["due_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -372,20 +362,15 @@ public required CustomerTaxID? CustomerTaxID { get { - if (!this.Properties.TryGetValue("eligible_to_issue_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("eligible_to_issue_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "eligible_to_issue_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["eligible_to_issue_at"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["eligible_to_issue_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -396,18 +381,15 @@ public required string? HostedInvoiceURL { get { - if (!this.Properties.TryGetValue("hosted_invoice_url", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("hosted_invoice_url", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "hosted_invoice_url", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["hosted_invoice_url"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["hosted_invoice_url"] = JsonSerializer.SerializeToElement(value); } } /// @@ -417,15 +399,15 @@ public required string? HostedInvoiceURL { get { - if (!this.Properties.TryGetValue("invoice_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -437,16 +419,16 @@ public required string InvoiceNumber { get { - if (!this.Properties.TryGetValue("invoice_number", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("invoice_number"); } - set { this.Properties["invoice_number"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_number"] = JsonSerializer.SerializeToElement(value); } } /// @@ -456,31 +438,31 @@ public required string? InvoicePdf { get { - if (!this.Properties.TryGetValue("invoice_pdf", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_pdf", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_pdf", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice_pdf"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_pdf"] = JsonSerializer.SerializeToElement(value); } } public required InvoiceProperties::InvoiceSource InvoiceSource { get { - if (!this.Properties.TryGetValue("invoice_source", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_source", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_source", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("invoice_source"); } - set { this.Properties["invoice_source"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_source"] = JsonSerializer.SerializeToElement(value); } } /// @@ -491,15 +473,15 @@ public required string? InvoicePdf { get { - if (!this.Properties.TryGetValue("issue_failed_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("issue_failed_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "issue_failed_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["issue_failed_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["issue_failed_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -510,65 +492,64 @@ public required string? InvoicePdf { get { - if (!this.Properties.TryGetValue("issued_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("issued_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "issued_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["issued_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["issued_at"] = JsonSerializer.SerializeToElement(value); } } /// /// The breakdown of prices in this invoice. /// - public required Generic::List LineItems + public required List LineItems { get { - if (!this.Properties.TryGetValue("line_items", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line_items", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("line_items"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("line_items"); } - set { this.Properties["line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line_items"] = JsonSerializer.SerializeToElement(value); } } public required Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -578,12 +559,12 @@ public required string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) throw new System::ArgumentOutOfRangeException("memo", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -592,50 +573,50 @@ public required string? Memo /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -646,38 +627,34 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("paid_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("paid_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "paid_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["paid_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["paid_at"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of payment attempts associated with the invoice /// - public required Generic::List PaymentAttempts + public required List PaymentAttempts { get { - if (!this.Properties.TryGetValue("payment_attempts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_attempts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_attempts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("payment_attempts"); - } - set - { - this.Properties["payment_attempts"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("payment_attempts"); } + set { this.Properties["payment_attempts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -688,18 +665,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("payment_failed_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_failed_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_failed_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_failed_at"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_failed_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -711,18 +685,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("payment_started_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_started_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_started_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_started_at"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_started_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -733,67 +704,61 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("scheduled_issue_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("scheduled_issue_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "scheduled_issue_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["scheduled_issue_at"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["scheduled_issue_at"] = JsonSerializer.SerializeToElement(value); } } public required Address? ShippingAddress { get { - if (!this.Properties.TryGetValue("shipping_address", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("shipping_address", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "shipping_address", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["shipping_address"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["shipping_address"] = JsonSerializer.SerializeToElement(value); } } public required InvoiceProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required SubscriptionMinified? Subscription { get { - if (!this.Properties.TryGetValue("subscription", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subscription", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subscription", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["subscription"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); } } /// @@ -803,16 +768,16 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -824,15 +789,15 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("sync_failed_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("sync_failed_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "sync_failed_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["sync_failed_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["sync_failed_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -842,13 +807,13 @@ public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } /// @@ -859,15 +824,15 @@ public required string Total { get { - if (!this.Properties.TryGetValue("voided_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["voided_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["voided_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -878,15 +843,15 @@ public required bool WillAutoIssue { get { - if (!this.Properties.TryGetValue("will_auto_issue", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("will_auto_issue", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "will_auto_issue", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["will_auto_issue"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["will_auto_issue"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -955,16 +920,14 @@ public override void Validate() public Invoice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Invoice(Generic::Dictionary properties) + [SetsRequiredMembers] + Invoice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Invoice FromRawUnchecked( - Generic::Dictionary properties - ) + public static Invoice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/InvoiceLevelDiscount.cs b/src/Orb/Models/InvoiceLevelDiscount.cs index 849a5121..f98da79f 100644 --- a/src/Orb/Models/InvoiceLevelDiscount.cs +++ b/src/Orb/Models/InvoiceLevelDiscount.cs @@ -1,23 +1,21 @@ +using System.Text.Json.Serialization; using InvoiceLevelDiscountVariants = Orb.Models.InvoiceLevelDiscountVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class InvoiceLevelDiscount { internal InvoiceLevelDiscount() { } - public static InvoiceLevelDiscountVariants::PercentageDiscount Create( - PercentageDiscount value - ) => new(value); + public static implicit operator InvoiceLevelDiscount(PercentageDiscount value) => + new InvoiceLevelDiscountVariants::PercentageDiscountVariant(value); - public static InvoiceLevelDiscountVariants::AmountDiscount Create(AmountDiscount value) => - new(value); + public static implicit operator InvoiceLevelDiscount(AmountDiscount value) => + new InvoiceLevelDiscountVariants::AmountDiscountVariant(value); - public static InvoiceLevelDiscountVariants::TrialDiscount Create(TrialDiscount value) => - new(value); + public static implicit operator InvoiceLevelDiscount(TrialDiscount value) => + new InvoiceLevelDiscountVariants::TrialDiscountVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/InvoiceLevelDiscountVariants/All.cs b/src/Orb/Models/InvoiceLevelDiscountVariants/All.cs index 79f191ce..a489e287 100644 --- a/src/Orb/Models/InvoiceLevelDiscountVariants/All.cs +++ b/src/Orb/Models/InvoiceLevelDiscountVariants/All.cs @@ -1,17 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.InvoiceLevelDiscountVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class PercentageDiscount(Models::PercentageDiscount Value) - : Models::InvoiceLevelDiscount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class PercentageDiscountVariant(PercentageDiscount Value) + : InvoiceLevelDiscount, + IVariant { - public static PercentageDiscount From(Models::PercentageDiscount value) + public static PercentageDiscountVariant From(PercentageDiscount value) { return new(value); } @@ -22,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmountDiscount(Models::AmountDiscount Value) - : Models::InvoiceLevelDiscount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmountDiscountVariant(AmountDiscount Value) + : InvoiceLevelDiscount, + IVariant { - public static AmountDiscount From(Models::AmountDiscount value) + public static AmountDiscountVariant From(AmountDiscount value) { return new(value); } @@ -40,12 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class TrialDiscount(Models::TrialDiscount Value) - : Models::InvoiceLevelDiscount, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class TrialDiscountVariant(TrialDiscount Value) + : InvoiceLevelDiscount, + IVariant { - public static TrialDiscount From(Models::TrialDiscount value) + public static TrialDiscountVariant From(TrialDiscount value) { return new(value); } diff --git a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateParams.cs b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateParams.cs index ecebe476..1e2f95da 100644 --- a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateParams.cs +++ b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.InvoiceLineItems; @@ -11,9 +10,9 @@ namespace Orb.Models.InvoiceLineItems; /// This creates a one-off fixed fee invoice line item on an Invoice. This can only /// be done for invoices that are in a `draft` status. /// -public sealed record class InvoiceLineItemCreateParams : Orb::ParamsBase +public sealed record class InvoiceLineItemCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// The total amount in the invoice's currency to add to the line item. @@ -22,34 +21,28 @@ public required string Amount { get { - if (!this.BodyProperties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + if (!this.BodyProperties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.BodyProperties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["amount"] = JsonSerializer.SerializeToElement(value); } } /// /// A date string to specify the line item's end date in the customer's timezone. /// - public required System::DateOnly EndDate + public required DateOnly EndDate { get { - if (!this.BodyProperties.TryGetValue("end_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "end_date", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("end_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("end_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,16 +52,13 @@ public required string InvoiceID { get { - if (!this.BodyProperties.TryGetValue("invoice_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "invoice_id", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoice_id"); + if (!this.BodyProperties.TryGetValue("invoice_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("invoice_id", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoice_id"); } - set { this.BodyProperties["invoice_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["invoice_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -79,13 +69,13 @@ public required string Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,60 +85,52 @@ public required double Quantity { get { - if (!this.BodyProperties.TryGetValue("quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "quantity", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException("quantity", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// /// A date string to specify the line item's start date in the customer's timezone. /// - public required System::DateOnly StartDate + public required DateOnly StartDate { get { - if (!this.BodyProperties.TryGetValue("start_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "start_date", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("start_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("start_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["start_date"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( - client.BaseUrl.ToString().TrimEnd('/') + "/invoice_line_items" - ) + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/invoice_line_items") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponse.cs b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponse.cs index b22001a7..298d1bf7 100644 --- a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponse.cs +++ b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponse.cs @@ -1,18 +1,17 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using InvoiceLineItemCreateResponseProperties = Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.InvoiceLineItems; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class InvoiceLineItemCreateResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// A unique ID for this line item. @@ -21,13 +20,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,19 +37,16 @@ public required string AdjustedSubtotal { get { - if (!this.Properties.TryGetValue("adjusted_subtotal", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("adjusted_subtotal", out JsonElement element)) + throw new ArgumentOutOfRangeException( "adjusted_subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("adjusted_subtotal"); - } - set - { - this.Properties["adjusted_subtotal"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjusted_subtotal"); } + set { this.Properties["adjusted_subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -58,21 +54,18 @@ public required string AdjustedSubtotal /// on invoice calculations (ie. usage discounts -> amount discounts -> percentage /// discounts -> minimums -> maximums). /// - public required Generic::List Adjustments + public required List Adjustments { get { - if (!this.Properties.TryGetValue("adjustments", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustments", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustments", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustments", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustments"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new ArgumentNullException("adjustments"); } - set { this.Properties["adjustments"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustments"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,16 +76,13 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "amount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("amount", out JsonElement element)) + throw new ArgumentOutOfRangeException("amount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,52 +92,46 @@ public required string CreditsApplied { get { - if (!this.Properties.TryGetValue("credits_applied", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credits_applied", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credits_applied", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("credits_applied"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("credits_applied"); } - set { this.Properties["credits_applied"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credits_applied"] = JsonSerializer.SerializeToElement(value); } } /// /// This field is deprecated in favor of `adjustments` /// - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } /// /// The end date of the range of time applied for this line item's price. /// - public required System::DateTime EndDate + public required DateTime EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "end_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("end_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,15 +141,12 @@ public required string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "filter", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("filter", out JsonElement element)) + throw new ArgumentOutOfRangeException("filter", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// @@ -177,15 +158,12 @@ public required string? Grouping { get { - if (!this.Properties.TryGetValue("grouping", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "grouping", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("grouping", out JsonElement element)) + throw new ArgumentOutOfRangeException("grouping", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["grouping"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,15 +173,12 @@ public required string? Grouping { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,15 +188,15 @@ public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,15 +206,12 @@ public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } /// @@ -249,15 +221,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -267,13 +239,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,25 +255,18 @@ public required string PartiallyInvoicedAmount { get { - if ( - !this.Properties.TryGetValue( - "partially_invoiced_amount", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("partially_invoiced_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "partially_invoiced_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("partially_invoiced_amount"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("partially_invoiced_amount"); } set { - this.Properties["partially_invoiced_amount"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["partially_invoiced_amount"] = JsonSerializer.SerializeToElement(value); } } @@ -320,13 +285,13 @@ public required string PartiallyInvoicedAmount { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("price", "Missing required argument"); + if (!this.Properties.TryGetValue("price", out JsonElement element)) + throw new ArgumentOutOfRangeException("price", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price"); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -336,53 +301,47 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "quantity", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException("quantity", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// /// The start date of the range of time applied for this line item's price. /// - public required System::DateTime StartDate + public required DateTime StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "start_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("start_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// /// For complex pricing structures, the line item can be broken down further in `sub_line_items`. /// - public required Generic::List SubLineItems + public required List SubLineItems { get { - if (!this.Properties.TryGetValue("sub_line_items", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("sub_line_items", out JsonElement element)) + throw new ArgumentOutOfRangeException( "sub_line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("sub_line_items"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new ArgumentNullException("sub_line_items"); } - set { this.Properties["sub_line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["sub_line_items"] = JsonSerializer.SerializeToElement(value); } } /// @@ -392,57 +351,48 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "subtotal", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) + throw new ArgumentOutOfRangeException("subtotal", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("subtotal"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// /// An array of tax rates and their incurred tax amounts. Empty if no tax integration /// is configured. /// - public required Generic::List TaxAmounts + public required List TaxAmounts { get { - if (!this.Properties.TryGetValue("tax_amounts", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "tax_amounts", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("tax_amounts", out JsonElement element)) + throw new ArgumentOutOfRangeException("tax_amounts", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("tax_amounts"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("tax_amounts"); } - set { this.Properties["tax_amounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_amounts"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of customer ids that were used to calculate the usage for this line item. /// - public required Generic::List? UsageCustomerIDs + public required List? UsageCustomerIDs { get { - if (!this.Properties.TryGetValue("usage_customer_ids", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("usage_customer_ids", out JsonElement element)) + throw new ArgumentOutOfRangeException( "usage_customer_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -486,15 +436,15 @@ public override void Validate() public InvoiceLineItemCreateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceLineItemCreateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceLineItemCreateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static InvoiceLineItemCreateResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/Adjustment.cs b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/Adjustment.cs index 461f2f8a..4f446ae9 100644 --- a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/Adjustment.cs +++ b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/Adjustment.cs @@ -1,34 +1,27 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::MonetaryUsageDiscountAdjustment Create( - Models::MonetaryUsageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryUsageDiscountAdjustment value) => + new AdjustmentVariants::MonetaryUsageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryAmountDiscountAdjustment Create( - Models::MonetaryAmountDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryAmountDiscountAdjustment value) => + new AdjustmentVariants::MonetaryAmountDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryPercentageDiscountAdjustment Create( - Models::MonetaryPercentageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryPercentageDiscountAdjustment value) => + new AdjustmentVariants::MonetaryPercentageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryMinimumAdjustment Create( - Models::MonetaryMinimumAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryMinimumAdjustment value) => + new AdjustmentVariants::MonetaryMinimumAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryMaximumAdjustment Create( - Models::MonetaryMaximumAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryMaximumAdjustment value) => + new AdjustmentVariants::MonetaryMaximumAdjustmentVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/AdjustmentVariants/All.cs b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/AdjustmentVariants/All.cs index 97e6304c..7dbf6078 100644 --- a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/AdjustmentVariants/All.cs @@ -1,25 +1,18 @@ -using InvoiceLineItemCreateResponseProperties = Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryUsageDiscountAdjustment, - Models::MonetaryUsageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryUsageDiscountAdjustmentVariant, + MonetaryUsageDiscountAdjustment >) )] -public sealed record class MonetaryUsageDiscountAdjustment( - Models::MonetaryUsageDiscountAdjustment Value -) - : InvoiceLineItemCreateResponseProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryUsageDiscountAdjustmentVariant( + MonetaryUsageDiscountAdjustment Value +) : Adjustment, IVariant { - public static MonetaryUsageDiscountAdjustment From( - Models::MonetaryUsageDiscountAdjustment value - ) + public static MonetaryUsageDiscountAdjustmentVariant From(MonetaryUsageDiscountAdjustment value) { return new(value); } @@ -30,20 +23,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryAmountDiscountAdjustment, - Models::MonetaryAmountDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryAmountDiscountAdjustmentVariant, + MonetaryAmountDiscountAdjustment >) )] -public sealed record class MonetaryAmountDiscountAdjustment( - Models::MonetaryAmountDiscountAdjustment Value -) - : InvoiceLineItemCreateResponseProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryAmountDiscountAdjustmentVariant( + MonetaryAmountDiscountAdjustment Value +) : Adjustment, IVariant { - public static MonetaryAmountDiscountAdjustment From( - Models::MonetaryAmountDiscountAdjustment value + public static MonetaryAmountDiscountAdjustmentVariant From( + MonetaryAmountDiscountAdjustment value ) { return new(value); @@ -55,23 +46,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryPercentageDiscountAdjustment, - Models::MonetaryPercentageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryPercentageDiscountAdjustmentVariant, + MonetaryPercentageDiscountAdjustment >) )] -public sealed record class MonetaryPercentageDiscountAdjustment( - Models::MonetaryPercentageDiscountAdjustment Value +public sealed record class MonetaryPercentageDiscountAdjustmentVariant( + MonetaryPercentageDiscountAdjustment Value ) - : InvoiceLineItemCreateResponseProperties::Adjustment, - Orb::IVariant< - MonetaryPercentageDiscountAdjustment, - Models::MonetaryPercentageDiscountAdjustment - > + : Adjustment, + IVariant { - public static MonetaryPercentageDiscountAdjustment From( - Models::MonetaryPercentageDiscountAdjustment value + public static MonetaryPercentageDiscountAdjustmentVariant From( + MonetaryPercentageDiscountAdjustment value ) { return new(value); @@ -83,14 +71,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class MonetaryMinimumAdjustment(Models::MonetaryMinimumAdjustment Value) - : InvoiceLineItemCreateResponseProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryMinimumAdjustmentVariant(MonetaryMinimumAdjustment Value) + : Adjustment, + IVariant { - public static MonetaryMinimumAdjustment From(Models::MonetaryMinimumAdjustment value) + public static MonetaryMinimumAdjustmentVariant From(MonetaryMinimumAdjustment value) { return new(value); } @@ -101,14 +89,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class MonetaryMaximumAdjustment(Models::MonetaryMaximumAdjustment Value) - : InvoiceLineItemCreateResponseProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryMaximumAdjustmentVariant(MonetaryMaximumAdjustment Value) + : Adjustment, + IVariant { - public static MonetaryMaximumAdjustment From(Models::MonetaryMaximumAdjustment value) + public static MonetaryMaximumAdjustmentVariant From(MonetaryMaximumAdjustment value) { return new(value); } diff --git a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItem.cs b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItem.cs index 5f4d78a8..0a13c123 100644 --- a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItem.cs +++ b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItem.cs @@ -1,23 +1,21 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using SubLineItemVariants = Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties.SubLineItemVariants; namespace Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class SubLineItem { internal SubLineItem() { } - public static SubLineItemVariants::MatrixSubLineItem Create(Models::MatrixSubLineItem value) => - new(value); + public static implicit operator SubLineItem(MatrixSubLineItem value) => + new SubLineItemVariants::MatrixSubLineItemVariant(value); - public static SubLineItemVariants::TierSubLineItem Create(Models::TierSubLineItem value) => - new(value); + public static implicit operator SubLineItem(TierSubLineItem value) => + new SubLineItemVariants::TierSubLineItemVariant(value); - public static SubLineItemVariants::OtherSubLineItem Create(Models::OtherSubLineItem value) => - new(value); + public static implicit operator SubLineItem(OtherSubLineItem value) => + new SubLineItemVariants::OtherSubLineItemVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItemVariants/All.cs b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItemVariants/All.cs index ef7d4d95..212c0c00 100644 --- a/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItemVariants/All.cs +++ b/src/Orb/Models/InvoiceLineItems/InvoiceLineItemCreateResponseProperties/SubLineItemVariants/All.cs @@ -1,18 +1,13 @@ -using InvoiceLineItemCreateResponseProperties = Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.InvoiceLineItems.InvoiceLineItemCreateResponseProperties.SubLineItemVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class MatrixSubLineItem(Models::MatrixSubLineItem Value) - : InvoiceLineItemCreateResponseProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class MatrixSubLineItemVariant(MatrixSubLineItem Value) + : SubLineItem, + IVariant { - public static MatrixSubLineItem From(Models::MatrixSubLineItem value) + public static MatrixSubLineItemVariant From(MatrixSubLineItem value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class TierSubLineItem(Models::TierSubLineItem Value) - : InvoiceLineItemCreateResponseProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class TierSubLineItemVariant(TierSubLineItem Value) + : SubLineItem, + IVariant { - public static TierSubLineItem From(Models::TierSubLineItem value) + public static TierSubLineItemVariant From(TierSubLineItem value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class OtherSubLineItem(Models::OtherSubLineItem Value) - : InvoiceLineItemCreateResponseProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class OtherSubLineItemVariant(OtherSubLineItem Value) + : SubLineItem, + IVariant { - public static OtherSubLineItem From(Models::OtherSubLineItem value) + public static OtherSubLineItemVariant From(OtherSubLineItem value) { return new(value); } diff --git a/src/Orb/Models/InvoiceProperties/AutoCollection.cs b/src/Orb/Models/InvoiceProperties/AutoCollection.cs index 60f75cca..64b0ec4d 100644 --- a/src/Orb/Models/InvoiceProperties/AutoCollection.cs +++ b/src/Orb/Models/InvoiceProperties/AutoCollection.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AutoCollection : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AutoCollection : ModelBase, IFromRaw { /// /// True only if auto-collection is enabled for this invoice. @@ -17,15 +16,15 @@ public required bool? Enabled { get { - if (!this.Properties.TryGetValue("enabled", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("enabled", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "enabled", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["enabled"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["enabled"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +36,15 @@ public required bool? Enabled { get { - if (!this.Properties.TryGetValue("next_attempt_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("next_attempt_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "next_attempt_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["next_attempt_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["next_attempt_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -55,15 +54,15 @@ public required long? NumAttempts { get { - if (!this.Properties.TryGetValue("num_attempts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("num_attempts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "num_attempts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["num_attempts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["num_attempts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,24 +77,17 @@ public required long? NumAttempts { get { - if ( - !this.Properties.TryGetValue( - "previously_attempted_at", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("previously_attempted_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "previously_attempted_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["previously_attempted_at"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["previously_attempted_at"] = JsonSerializer.SerializeToElement(value); } } @@ -110,16 +102,14 @@ public override void Validate() public AutoCollection() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AutoCollection(Generic::Dictionary properties) + [SetsRequiredMembers] + AutoCollection(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AutoCollection FromRawUnchecked( - Generic::Dictionary properties - ) + public static AutoCollection FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/InvoiceProperties/CreditNote.cs b/src/Orb/Models/InvoiceProperties/CreditNote1.cs similarity index 52% rename from src/Orb/Models/InvoiceProperties/CreditNote.cs rename to src/Orb/Models/InvoiceProperties/CreditNote1.cs index 82cb704e..b698bf4f 100644 --- a/src/Orb/Models/InvoiceProperties/CreditNote.cs +++ b/src/Orb/Models/InvoiceProperties/CreditNote1.cs @@ -1,45 +1,41 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CreditNote : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CreditNote1 : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string CreditNoteNumber { get { - if (!this.Properties.TryGetValue("credit_note_number", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_note_number"); } - set - { - this.Properties["credit_note_number"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["credit_note_number"] = JsonSerializer.SerializeToElement(value); } } /// @@ -49,54 +45,54 @@ public required string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) throw new System::ArgumentOutOfRangeException("memo", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } public required string Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("reason"); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } public required string Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -107,15 +103,15 @@ public required string Type { get { - if (!this.Properties.TryGetValue("voided_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["voided_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["voided_at"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -129,19 +125,17 @@ public override void Validate() _ = this.VoidedAt; } - public CreditNote() { } + public CreditNote1() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditNote(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditNote1(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CreditNote FromRawUnchecked( - Generic::Dictionary properties - ) + public static CreditNote1 FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/InvoiceProperties/CustomerBalanceTransaction.cs b/src/Orb/Models/InvoiceProperties/CustomerBalanceTransaction.cs index d4beab10..bba895ed 100644 --- a/src/Orb/Models/InvoiceProperties/CustomerBalanceTransaction.cs +++ b/src/Orb/Models/InvoiceProperties/CustomerBalanceTransaction.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CustomerBalanceTransactionProperties = Orb.Models.InvoiceProperties.CustomerBalanceTransactionProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class CustomerBalanceTransaction - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// A unique id for this transaction. @@ -21,30 +19,29 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required CustomerBalanceTransactionProperties::Action Action { get { - if (!this.Properties.TryGetValue("action", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("action", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "action", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("action"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("action"); } - set { this.Properties["action"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["action"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,16 +51,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,30 +70,30 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CreditNoteTiny? CreditNote + public required CreditNoteTiny? CreditNote { get { - if (!this.Properties.TryGetValue("credit_note", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["credit_note"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_note"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,15 +103,15 @@ public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,31 +121,31 @@ public required string EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("ending_balance"); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } - public required Models::InvoiceTiny? Invoice + public required InvoiceTiny? Invoice { get { - if (!this.Properties.TryGetValue("invoice", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,33 +156,29 @@ public required string StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("starting_balance"); } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public required CustomerBalanceTransactionProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -205,15 +198,15 @@ public override void Validate() public CustomerBalanceTransaction() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomerBalanceTransaction(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomerBalanceTransaction(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CustomerBalanceTransaction FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Action.cs b/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Action.cs index 2818d206..6569d361 100644 --- a/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Action.cs +++ b/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Action.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties.CustomerBalanceTransactionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Action(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Action(string value) : IEnum { public static readonly Action AppliedToInvoice = new("applied_to_invoice"); diff --git a/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Type.cs b/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Type.cs index ec4f1bb8..676b3fe3 100644 --- a/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Type.cs +++ b/src/Orb/Models/InvoiceProperties/CustomerBalanceTransactionProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties.CustomerBalanceTransactionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Increment = new("increment"); diff --git a/src/Orb/Models/InvoiceProperties/InvoiceSource.cs b/src/Orb/Models/InvoiceProperties/InvoiceSource.cs index a36b18e5..312061bd 100644 --- a/src/Orb/Models/InvoiceProperties/InvoiceSource.cs +++ b/src/Orb/Models/InvoiceProperties/InvoiceSource.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class InvoiceSource(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class InvoiceSource(string value) : IEnum { public static readonly InvoiceSource Subscription = new("subscription"); diff --git a/src/Orb/Models/InvoiceProperties/LineItem.cs b/src/Orb/Models/InvoiceProperties/LineItem.cs index 1cd28674..7203119e 100644 --- a/src/Orb/Models/InvoiceProperties/LineItem.cs +++ b/src/Orb/Models/InvoiceProperties/LineItem.cs @@ -1,16 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using LineItemProperties = Orb.Models.InvoiceProperties.LineItemProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class LineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class LineItem : ModelBase, IFromRaw { /// /// A unique ID for this line item. @@ -19,13 +18,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,19 +35,16 @@ public required string AdjustedSubtotal { get { - if (!this.Properties.TryGetValue("adjusted_subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjusted_subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjusted_subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("adjusted_subtotal"); } - set - { - this.Properties["adjusted_subtotal"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["adjusted_subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -56,21 +52,20 @@ public required string AdjustedSubtotal /// on invoice calculations (ie. usage discounts -> amount discounts -> percentage /// discounts -> minimums -> maximums). /// - public required Generic::List Adjustments + public required List Adjustments { get { - if (!this.Properties.TryGetValue("adjustments", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustments", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustments", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustments"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("adjustments"); } - set { this.Properties["adjustments"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustments"] = JsonSerializer.SerializeToElement(value); } } /// @@ -81,16 +76,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -100,34 +95,34 @@ public required string CreditsApplied { get { - if (!this.Properties.TryGetValue("credits_applied", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credits_applied", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credits_applied", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credits_applied"); } - set { this.Properties["credits_applied"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credits_applied"] = JsonSerializer.SerializeToElement(value); } } /// /// This field is deprecated in favor of `adjustments` /// - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +132,15 @@ public required string CreditsApplied { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,15 +150,15 @@ public required string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filter", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,15 +170,15 @@ public required string? Grouping { get { - if (!this.Properties.TryGetValue("grouping", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouping", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["grouping"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping"] = JsonSerializer.SerializeToElement(value); } } /// @@ -193,15 +188,15 @@ public required string? Grouping { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } /// @@ -211,15 +206,15 @@ public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -229,15 +224,15 @@ public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } /// @@ -247,15 +242,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -265,13 +260,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -281,25 +276,18 @@ public required string PartiallyInvoicedAmount { get { - if ( - !this.Properties.TryGetValue( - "partially_invoiced_amount", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("partially_invoiced_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "partially_invoiced_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("partially_invoiced_amount"); } set { - this.Properties["partially_invoiced_amount"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["partially_invoiced_amount"] = JsonSerializer.SerializeToElement(value); } } @@ -318,13 +306,13 @@ public required string PartiallyInvoicedAmount { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) throw new System::ArgumentOutOfRangeException("price", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price"); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -334,15 +322,15 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -352,35 +340,34 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// /// For complex pricing structures, the line item can be broken down further in `sub_line_items`. /// - public required Generic::List SubLineItems + public required List SubLineItems { get { - if (!this.Properties.TryGetValue("sub_line_items", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("sub_line_items", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "sub_line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("sub_line_items"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("sub_line_items"); } - set { this.Properties["sub_line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["sub_line_items"] = JsonSerializer.SerializeToElement(value); } } /// @@ -390,57 +377,54 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// /// An array of tax rates and their incurred tax amounts. Empty if no tax integration /// is configured. /// - public required Generic::List TaxAmounts + public required List TaxAmounts { get { - if (!this.Properties.TryGetValue("tax_amounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_amounts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_amounts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tax_amounts"); } - set { this.Properties["tax_amounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_amounts"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of customer ids that were used to calculate the usage for this line item. /// - public required Generic::List? UsageCustomerIDs + public required List? UsageCustomerIDs { get { - if (!this.Properties.TryGetValue("usage_customer_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_customer_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_customer_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -484,16 +468,14 @@ public override void Validate() public LineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + LineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static LineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static LineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/InvoiceProperties/LineItemProperties/Adjustment.cs b/src/Orb/Models/InvoiceProperties/LineItemProperties/Adjustment.cs index 0f8eec3e..5868bfdc 100644 --- a/src/Orb/Models/InvoiceProperties/LineItemProperties/Adjustment.cs +++ b/src/Orb/Models/InvoiceProperties/LineItemProperties/Adjustment.cs @@ -1,34 +1,27 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.InvoiceProperties.LineItemProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.InvoiceProperties.LineItemProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::MonetaryUsageDiscountAdjustment Create( - Models::MonetaryUsageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryUsageDiscountAdjustment value) => + new AdjustmentVariants::MonetaryUsageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryAmountDiscountAdjustment Create( - Models::MonetaryAmountDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryAmountDiscountAdjustment value) => + new AdjustmentVariants::MonetaryAmountDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryPercentageDiscountAdjustment Create( - Models::MonetaryPercentageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryPercentageDiscountAdjustment value) => + new AdjustmentVariants::MonetaryPercentageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryMinimumAdjustment Create( - Models::MonetaryMinimumAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryMinimumAdjustment value) => + new AdjustmentVariants::MonetaryMinimumAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryMaximumAdjustment Create( - Models::MonetaryMaximumAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryMaximumAdjustment value) => + new AdjustmentVariants::MonetaryMaximumAdjustmentVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/InvoiceProperties/LineItemProperties/AdjustmentVariants/All.cs b/src/Orb/Models/InvoiceProperties/LineItemProperties/AdjustmentVariants/All.cs index 68da18e2..59170628 100644 --- a/src/Orb/Models/InvoiceProperties/LineItemProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/InvoiceProperties/LineItemProperties/AdjustmentVariants/All.cs @@ -1,25 +1,18 @@ -using LineItemProperties = Orb.Models.InvoiceProperties.LineItemProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.InvoiceProperties.LineItemProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryUsageDiscountAdjustment, - Models::MonetaryUsageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryUsageDiscountAdjustmentVariant, + MonetaryUsageDiscountAdjustment >) )] -public sealed record class MonetaryUsageDiscountAdjustment( - Models::MonetaryUsageDiscountAdjustment Value -) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryUsageDiscountAdjustmentVariant( + MonetaryUsageDiscountAdjustment Value +) : Adjustment, IVariant { - public static MonetaryUsageDiscountAdjustment From( - Models::MonetaryUsageDiscountAdjustment value - ) + public static MonetaryUsageDiscountAdjustmentVariant From(MonetaryUsageDiscountAdjustment value) { return new(value); } @@ -30,20 +23,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryAmountDiscountAdjustment, - Models::MonetaryAmountDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryAmountDiscountAdjustmentVariant, + MonetaryAmountDiscountAdjustment >) )] -public sealed record class MonetaryAmountDiscountAdjustment( - Models::MonetaryAmountDiscountAdjustment Value -) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryAmountDiscountAdjustmentVariant( + MonetaryAmountDiscountAdjustment Value +) : Adjustment, IVariant { - public static MonetaryAmountDiscountAdjustment From( - Models::MonetaryAmountDiscountAdjustment value + public static MonetaryAmountDiscountAdjustmentVariant From( + MonetaryAmountDiscountAdjustment value ) { return new(value); @@ -55,23 +46,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryPercentageDiscountAdjustment, - Models::MonetaryPercentageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryPercentageDiscountAdjustmentVariant, + MonetaryPercentageDiscountAdjustment >) )] -public sealed record class MonetaryPercentageDiscountAdjustment( - Models::MonetaryPercentageDiscountAdjustment Value +public sealed record class MonetaryPercentageDiscountAdjustmentVariant( + MonetaryPercentageDiscountAdjustment Value ) - : LineItemProperties::Adjustment, - Orb::IVariant< - MonetaryPercentageDiscountAdjustment, - Models::MonetaryPercentageDiscountAdjustment - > + : Adjustment, + IVariant { - public static MonetaryPercentageDiscountAdjustment From( - Models::MonetaryPercentageDiscountAdjustment value + public static MonetaryPercentageDiscountAdjustmentVariant From( + MonetaryPercentageDiscountAdjustment value ) { return new(value); @@ -83,14 +71,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class MonetaryMinimumAdjustment(Models::MonetaryMinimumAdjustment Value) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryMinimumAdjustmentVariant(MonetaryMinimumAdjustment Value) + : Adjustment, + IVariant { - public static MonetaryMinimumAdjustment From(Models::MonetaryMinimumAdjustment value) + public static MonetaryMinimumAdjustmentVariant From(MonetaryMinimumAdjustment value) { return new(value); } @@ -101,14 +89,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class MonetaryMaximumAdjustment(Models::MonetaryMaximumAdjustment Value) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryMaximumAdjustmentVariant(MonetaryMaximumAdjustment Value) + : Adjustment, + IVariant { - public static MonetaryMaximumAdjustment From(Models::MonetaryMaximumAdjustment value) + public static MonetaryMaximumAdjustmentVariant From(MonetaryMaximumAdjustment value) { return new(value); } diff --git a/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItem.cs b/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItem.cs index dcdb74f6..75fc08f9 100644 --- a/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItem.cs +++ b/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItem.cs @@ -1,23 +1,21 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using SubLineItemVariants = Orb.Models.InvoiceProperties.LineItemProperties.SubLineItemVariants; namespace Orb.Models.InvoiceProperties.LineItemProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class SubLineItem { internal SubLineItem() { } - public static SubLineItemVariants::MatrixSubLineItem Create(Models::MatrixSubLineItem value) => - new(value); + public static implicit operator SubLineItem(MatrixSubLineItem value) => + new SubLineItemVariants::MatrixSubLineItemVariant(value); - public static SubLineItemVariants::TierSubLineItem Create(Models::TierSubLineItem value) => - new(value); + public static implicit operator SubLineItem(TierSubLineItem value) => + new SubLineItemVariants::TierSubLineItemVariant(value); - public static SubLineItemVariants::OtherSubLineItem Create(Models::OtherSubLineItem value) => - new(value); + public static implicit operator SubLineItem(OtherSubLineItem value) => + new SubLineItemVariants::OtherSubLineItemVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItemVariants/All.cs b/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItemVariants/All.cs index 23581405..26236caa 100644 --- a/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItemVariants/All.cs +++ b/src/Orb/Models/InvoiceProperties/LineItemProperties/SubLineItemVariants/All.cs @@ -1,18 +1,13 @@ -using LineItemProperties = Orb.Models.InvoiceProperties.LineItemProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.InvoiceProperties.LineItemProperties.SubLineItemVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class MatrixSubLineItem(Models::MatrixSubLineItem Value) - : LineItemProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class MatrixSubLineItemVariant(MatrixSubLineItem Value) + : SubLineItem, + IVariant { - public static MatrixSubLineItem From(Models::MatrixSubLineItem value) + public static MatrixSubLineItemVariant From(MatrixSubLineItem value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class TierSubLineItem(Models::TierSubLineItem Value) - : LineItemProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class TierSubLineItemVariant(TierSubLineItem Value) + : SubLineItem, + IVariant { - public static TierSubLineItem From(Models::TierSubLineItem value) + public static TierSubLineItemVariant From(TierSubLineItem value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class OtherSubLineItem(Models::OtherSubLineItem Value) - : LineItemProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class OtherSubLineItemVariant(OtherSubLineItem Value) + : SubLineItem, + IVariant { - public static OtherSubLineItem From(Models::OtherSubLineItem value) + public static OtherSubLineItemVariant From(OtherSubLineItem value) { return new(value); } diff --git a/src/Orb/Models/InvoiceProperties/PaymentAttempt.cs b/src/Orb/Models/InvoiceProperties/PaymentAttempt.cs index 38c9051d..281a3264 100644 --- a/src/Orb/Models/InvoiceProperties/PaymentAttempt.cs +++ b/src/Orb/Models/InvoiceProperties/PaymentAttempt.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PaymentAttemptProperties = Orb.Models.InvoiceProperties.PaymentAttemptProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PaymentAttempt : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PaymentAttempt : ModelBase, IFromRaw { /// /// The ID of the payment attempt. @@ -18,13 +17,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,16 +33,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,15 +52,15 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,20 +70,15 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("payment_provider", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_provider", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_provider", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); - } - set - { - this.Properties["payment_provider"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_provider"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,18 +88,15 @@ public required string? PaymentProviderID { get { - if (!this.Properties.TryGetValue("payment_provider_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_provider_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_provider_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_provider_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_provider_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -115,15 +106,15 @@ public required bool Succeeded { get { - if (!this.Properties.TryGetValue("succeeded", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("succeeded", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "succeeded", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["succeeded"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["succeeded"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -139,16 +130,14 @@ public override void Validate() public PaymentAttempt() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PaymentAttempt(Generic::Dictionary properties) + [SetsRequiredMembers] + PaymentAttempt(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PaymentAttempt FromRawUnchecked( - Generic::Dictionary properties - ) + public static PaymentAttempt FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/InvoiceProperties/PaymentAttemptProperties/PaymentProvider.cs b/src/Orb/Models/InvoiceProperties/PaymentAttemptProperties/PaymentProvider.cs index 3b4d5966..c2baa1c7 100644 --- a/src/Orb/Models/InvoiceProperties/PaymentAttemptProperties/PaymentProvider.cs +++ b/src/Orb/Models/InvoiceProperties/PaymentAttemptProperties/PaymentProvider.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.InvoiceProperties.PaymentAttemptProperties; /// /// The payment provider that attempted to collect the payment. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PaymentProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PaymentProvider(string value) : IEnum { public static readonly PaymentProvider Stripe = new("stripe"); @@ -23,7 +22,7 @@ public Value Known() => _value switch { "stripe" => Value.Stripe, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/InvoiceProperties/Status.cs b/src/Orb/Models/InvoiceProperties/Status.cs index 4f3f7524..3793ef58 100644 --- a/src/Orb/Models/InvoiceProperties/Status.cs +++ b/src/Orb/Models/InvoiceProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.InvoiceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Issued = new("issued"); diff --git a/src/Orb/Models/InvoiceTiny.cs b/src/Orb/Models/InvoiceTiny.cs index bbbdbc83..6f616d46 100644 --- a/src/Orb/Models/InvoiceTiny.cs +++ b/src/Orb/Models/InvoiceTiny.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class InvoiceTiny : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class InvoiceTiny : ModelBase, IFromRaw { /// /// The Invoice id @@ -17,13 +16,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -34,16 +33,14 @@ public override void Validate() public InvoiceTiny() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceTiny(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceTiny(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static InvoiceTiny FromRawUnchecked( - Generic::Dictionary properties - ) + public static InvoiceTiny FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Invoices/InvoiceCreateParams.cs b/src/Orb/Models/Invoices/InvoiceCreateParams.cs index 3b995908..addced70 100644 --- a/src/Orb/Models/Invoices/InvoiceCreateParams.cs +++ b/src/Orb/Models/Invoices/InvoiceCreateParams.cs @@ -1,20 +1,18 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using InvoiceCreateParamsProperties = Orb.Models.Invoices.InvoiceCreateParamsProperties; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; using System = System; -using Text = System.Text; namespace Orb.Models.Invoices; /// /// This endpoint is used to create a one-off invoice for a customer. /// -public sealed record class InvoiceCreateParams : Orb::ParamsBase +public sealed record class InvoiceCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// An ISO 4217 currency string. Must be the same as the customer's currency if @@ -24,16 +22,16 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -44,56 +42,32 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("invoice_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("invoice_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["invoice_date"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["invoice_date"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List LineItems + public required List LineItems { get { - if (!this.BodyProperties.TryGetValue("line_items", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("line_items", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element ) ?? throw new System::ArgumentNullException("line_items"); } - set { this.BodyProperties["line_items"] = Json::JsonSerializer.SerializeToElement(value); } - } - - /// - /// Determines the difference between the invoice issue date for subscription invoices - /// as the date that they are due. A value of '0' here represents that the invoice - /// is due on issue, whereas a value of 30 represents that the customer has 30 days - /// to pay the invoice. - /// - public required long NetTerms - { - get - { - if (!this.BodyProperties.TryGetValue("net_terms", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "net_terms", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element); - } - set { this.BodyProperties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["line_items"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,27 +78,27 @@ public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// /// An optional discount to attach to the invoice. /// - public Models::Discount? Discount + public Discount2? Discount { get { - if (!this.BodyProperties.TryGetValue("discount", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,21 +109,14 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -160,12 +127,12 @@ public string? Memo { get { - if (!this.BodyProperties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -173,16 +140,34 @@ public string? Memo /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata + { + get + { + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) + return null; + + return JsonSerializer.Deserialize?>(element); + } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } + } + + /// + /// Determines the difference between the invoice issue date for subscription invoices + /// as the date that they are due. A value of '0' here represents that the invoice + /// is due on issue, whereas a value of 30 represents that the customer has 30 days + /// to pay the invoice. + /// + public long? NetTerms { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("net_terms", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -193,18 +178,15 @@ public bool? WillAutoIssue { get { - if (!this.BodyProperties.TryGetValue("will_auto_issue", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("will_auto_issue", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["will_auto_issue"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["will_auto_issue"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/invoices") { @@ -212,21 +194,21 @@ public bool? WillAutoIssue }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItem.cs b/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItem.cs index 8e2d2712..a7ea194c 100644 --- a/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItem.cs +++ b/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItem.cs @@ -1,65 +1,55 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using LineItemProperties = Orb.Models.Invoices.InvoiceCreateParamsProperties.LineItemProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Invoices.InvoiceCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class LineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class LineItem : ModelBase, IFromRaw { /// /// A date string to specify the line item's end date in the customer's timezone. /// - public required System::DateOnly EndDate + public required DateOnly EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "end_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("end_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "item_id", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item_id"); + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("item_id", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required LineItemProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -69,13 +59,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -85,49 +75,40 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "quantity", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException("quantity", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// /// A date string to specify the line item's start date in the customer's timezone. /// - public required System::DateOnly StartDate + public required DateOnly StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "start_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("start_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public required Models::UnitConfig UnitConfig { get { - if (!this.Properties.TryGetValue("unit_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "unit_config", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("unit_config"); + if (!this.Properties.TryGetValue("unit_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("unit_config", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("unit_config"); } - set { this.Properties["unit_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_config"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -144,16 +125,14 @@ public override void Validate() public LineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + LineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static LineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static LineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItemProperties/ModelType.cs b/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItemProperties/ModelType.cs index f177acf7..f0b4b509 100644 --- a/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItemProperties/ModelType.cs +++ b/src/Orb/Models/Invoices/InvoiceCreateParamsProperties/LineItemProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceCreateParamsProperties.LineItemProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Unit = new("unit"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit" => Value.Unit, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Invoices/InvoiceFetchParams.cs b/src/Orb/Models/Invoices/InvoiceFetchParams.cs index 474f3158..389c1d60 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchParams.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Invoices; @@ -7,11 +6,11 @@ namespace Orb.Models.Invoices; /// /// This endpoint is used to fetch an [`Invoice`](/core-concepts#invoice) given an identifier. /// -public sealed record class InvoiceFetchParams : Orb::ParamsBase +public sealed record class InvoiceFetchParams : ParamsBase { public required string InvoiceID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/invoices/{0}", this.InvoiceID) @@ -21,12 +20,12 @@ public sealed record class InvoiceFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingParams.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingParams.cs index 5d9a7ccf..c3985970 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingParams.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Invoices; @@ -9,30 +8,25 @@ namespace Orb.Models.Invoices; /// This endpoint can be used to fetch the upcoming [invoice](/core-concepts#invoice) /// for the current billing period given a subscription. /// -public sealed record class InvoiceFetchUpcomingParams : Orb::ParamsBase +public sealed record class InvoiceFetchUpcomingParams : ParamsBase { public required string SubscriptionID { get { - if (!this.QueryProperties.TryGetValue("subscription_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("subscription_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subscription_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subscription_id"); } - set - { - this.QueryProperties["subscription_id"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.QueryProperties["subscription_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/invoices/upcoming") { @@ -40,12 +34,12 @@ public required string SubscriptionID }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponse.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponse.cs index af6e54a5..29a4c0cb 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponse.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponse.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using InvoiceFetchUpcomingResponseProperties = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class InvoiceFetchUpcomingResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,48 +34,48 @@ public required string AmountDue { get { - if (!this.Properties.TryGetValue("amount_due", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_due", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_due", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_due"); } - set { this.Properties["amount_due"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_due"] = JsonSerializer.SerializeToElement(value); } } public required InvoiceFetchUpcomingResponseProperties::AutoCollection AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("auto_collection"); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public required Models::Address? BillingAddress { get { - if (!this.Properties.TryGetValue("billing_address", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billing_address", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "billing_address", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billing_address"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billing_address"] = JsonSerializer.SerializeToElement(value); } } /// @@ -86,35 +85,35 @@ public required string AmountDue { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of credit notes associated with the invoice /// - public required Generic::List CreditNotes + public required List CreditNotes { get { - if (!this.Properties.TryGetValue("credit_notes", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_notes", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_notes", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("credit_notes"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("credit_notes"); } - set { this.Properties["credit_notes"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_notes"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,42 +123,42 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } public required Models::CustomerMinified Customer { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List CustomerBalanceTransactions + public required List CustomerBalanceTransactions { get { if ( !this.Properties.TryGetValue( "customer_balance_transactions", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -167,14 +166,16 @@ public required string Currency "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("customer_balance_transactions"); + return JsonSerializer.Deserialize< + List + >(element) + ?? throw new System::ArgumentNullException("customer_balance_transactions"); } set { - this.Properties["customer_balance_transactions"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["customer_balance_transactions"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -184,125 +185,116 @@ public required string Currency /// /// ### Supported Tax ID Countries and Types /// - /// | Country | Type | Description - /// | |----------------|--------------|---------------------------------------------| - /// | Andorra | `ad_nrt` | Andorran NRT Number - /// | | Argentina | `ar_cuit` | Argentinian Tax ID Number - /// | | Australia | `au_abn` | Australian Business Number (AU ABN) - /// | | Australia | `au_arn` | Australian Taxation Office - /// Reference Number | | Austria | `eu_vat` | European VAT Number - /// | | Bahrain | `bh_vat` | Bahraini VAT Number - /// | | Belgium | `eu_vat` | European VAT Number - /// | | Bolivia | `bo_tin` | Bolivian Tax ID - /// | | Brazil | `br_cnpj` | Brazilian CNPJ - /// Number | | Brazil | `br_cpf` | Brazilian CPF - /// Number | | Bulgaria | `bg_uic` | Bulgaria - /// Unified Identification Code | | Bulgaria | `eu_vat` | European - /// VAT Number | | Canada | `ca_bn` | Canadian - /// BN | | Canada | `ca_gst_hst` | Canadian - /// GST/HST Number | | Canada | `ca_pst_bc` | Canadian - /// PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian - /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian - /// PST Number (Saskatchewan) | | Canada | `ca_qst` | Canadian - /// QST Number (Québec) | | Chile | `cl_tin` | Chilean - /// TIN | | China | `cn_tin` | Chinese - /// Tax ID | | Colombia | `co_nit` | Colombian - /// NIT Number | | Costa Rica | `cr_tin` | Costa - /// Rican Tax ID | | Croatia | `eu_vat` | European - /// VAT Number | | Cyprus | `eu_vat` | European - /// VAT Number | | Czech Republic | `eu_vat` | European - /// VAT Number | | Denmark | `eu_vat` | European - /// VAT Number | | Dominican Republic | `do_rcn` | Dominican - /// RCN Number | | Ecuador | `ec_ruc` | Ecuadorian - /// RUC Number | | Egypt | `eg_tin` | Egyptian - /// Tax Identification Number | | El Salvador | `sv_nit` - /// | El Salvadorian NIT Number | | Estonia | `eu_vat` | - /// European VAT Number | | EU | `eu_oss_vat` | European One Stop Shop - /// VAT Number for non-Union scheme | | Finland | `eu_vat` | European VAT - /// Number | | France | `eu_vat` | European - /// VAT Number | | Georgia | `ge_vat` | - /// Georgian VAT | | Germany | `eu_vat` - /// | European VAT Number | | Greece - /// | `eu_vat` | European VAT Number | | - /// Hong Kong | `hk_br` | Hong Kong BR Number - /// | | Hungary | `eu_vat` | European VAT Number - /// | | Hungary | `hu_tin` | Hungary Tax Number (adószám) - /// | | Iceland | `is_vat` | Icelandic VAT - /// | | India | `in_gst` | Indian GST - /// Number | | Indonesia | `id_npwp` | Indonesian - /// NPWP Number | | Ireland | `eu_vat` | - /// European VAT Number | | Israel | `il_vat` - /// | Israel VAT | | Italy - /// | `eu_vat` | European VAT Number | | - /// Japan | `jp_cn` | Japanese Corporate Number (*Hōjin Bangō*) - /// | | Japan | `jp_rn` | Japanese Registered Foreign Businesses' - /// Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku Bangō*) | | - /// Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) - /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification - /// Number | | Kenya | `ke_pin` | Kenya Revenue Authority - /// Personal Identification Number | | Latvia | `eu_vat` | European VAT Number - /// | | Liechtenstein | `li_uid` | Liechtensteinian - /// UID Number | | Lithuania | `eu_vat` | European VAT Number - /// | | Luxembourg | `eu_vat` | European VAT Number - /// | | Malaysia | `my_frp` | Malaysian FRP Number - /// | | Malaysia | `my_itn` | Malaysian ITN - /// | | Malaysia | `my_sst` | Malaysian SST Number | - /// | Malta | `eu_vat ` | European VAT Number | | Mexico - /// | `mx_rfc` | Mexican RFC Number | | Netherlands - /// | `eu_vat` | European VAT Number | | New Zealand | - /// `nz_gst` | New Zealand GST Number | | Nigeria | - /// `ng_tin` | Nigerian Tax Identification Number | | Norway | `no_vat` - /// | Norwegian VAT Number | | Norway | `no_voec` | Norwegian - /// VAT on e-commerce Number | | Oman | `om_vat` | Omani VAT Number - /// | | Peru | `pe_ruc` | Peruvian RUC Number - /// | | Philippines | `ph_tin ` | Philippines Tax Identification - /// Number | | Poland | `eu_vat` | European VAT Number - /// | | Portugal | `eu_vat` | European VAT Number | | - /// Romania | `eu_vat` | European VAT Number | | Romania - /// | `ro_tin` | Romanian Tax ID Number | | Russia - /// | `ru_inn` | Russian INN | | Russia | `ru_kpp` - /// | Russian KPP | | Saudi Arabia | `sa_vat` | Saudi - /// Arabia VAT | | Serbia | `rs_pib` | Serbian PIB - /// Number | | Singapore | `sg_gst` | Singaporean GST - /// | | Singapore | `sg_uen` | Singaporean UEN - /// | | Slovakia | `eu_vat` | European VAT Number - /// | | Slovenia | `eu_vat` | European VAT Number - /// | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) - /// | | South Africa | `za_vat` | South African VAT - /// Number | | South Korea | `kr_brn` | Korean - /// BRN | | Spain | `es_cif` - /// | Spanish NIF Number (previously Spanish CIF Number) | | Spain - /// | `eu_vat` | European VAT Number | | - /// Sweden | `eu_vat` | European VAT Number - /// | | Switzerland | `ch_vat` | Switzerland VAT Number - /// | | Taiwan | `tw_vat` | Taiwanese VAT - /// | | Thailand | `th_vat` | - /// Thai VAT | | Turkey - /// | `tr_tin` | Turkish Tax Identification Number | | Ukraine - /// | `ua_vat` | Ukrainian VAT - /// | | United Arab Emirates | `ae_trn` | United Arab Emirates TRN - /// | | United Kingdom | `eu_vat` | Northern Ireland - /// VAT Number | | United Kingdom | `gb_vat` | United - /// Kingdom VAT Number | | United States | `us_ein` - /// | United States EIN | | Uruguay - /// | `uy_ruc` | Uruguayan RUC Number | | Venezuela - /// | `ve_rif` | Venezuelan RIF Number - /// | | Vietnam | `vn_tin` | Vietnamese Tax ID Number - /// | + /// | Country | Type | Description | |---------|------|-------------| | Albania + /// | `al_tin` | Albania Tax Identification Number | | Andorra | `ad_nrt` | Andorran + /// NRT Number | | Angola | `ao_tin` | Angola Tax Identification Number | | Argentina + /// | `ar_cuit` | Argentinian Tax ID Number | | Armenia | `am_tin` | Armenia Tax + /// Identification Number | | Aruba | `aw_tin` | Aruba Tax Identification Number + /// | | Australia | `au_abn` | Australian Business Number (AU ABN) | | Australia + /// | `au_arn` | Australian Taxation Office Reference Number | | Austria | `eu_vat` + /// | European VAT Number | | Azerbaijan | `az_tin` | Azerbaijan Tax Identification + /// Number | | Bahamas | `bs_tin` | Bahamas Tax Identification Number | | Bahrain + /// | `bh_vat` | Bahraini VAT Number | | Bangladesh | `bd_bin` | Bangladesh Business + /// Identification Number | | Barbados | `bb_tin` | Barbados Tax Identification + /// Number | | Belarus | `by_tin` | Belarus TIN Number | | Belgium | `eu_vat` | + /// European VAT Number | | Benin | `bj_ifu` | Benin Tax Identification Number (Identifiant + /// Fiscal Unique) | | Bolivia | `bo_tin` | Bolivian Tax ID | | Bosnia and Herzegovina + /// | `ba_tin` | Bosnia and Herzegovina Tax Identification Number | | Brazil | `br_cnpj` + /// | Brazilian CNPJ Number | | Brazil | `br_cpf` | Brazilian CPF Number | | Bulgaria + /// | `bg_uic` | Bulgaria Unified Identification Code | | Bulgaria | `eu_vat` | + /// European VAT Number | | Burkina Faso | `bf_ifu` | Burkina Faso Tax Identification + /// Number (Numéro d'Identifiant Fiscal Unique) | | Cambodia | `kh_tin` | Cambodia + /// Tax Identification Number | | Cameroon | `cm_niu` | Cameroon Tax Identification + /// Number (Numéro d'Identifiant fiscal Unique) | | Canada | `ca_bn` | Canadian + /// BN | | Canada | `ca_gst_hst` | Canadian GST/HST Number | | Canada | `ca_pst_bc` + /// | Canadian PST Number (British Columbia) | | Canada | `ca_pst_mb` | Canadian + /// PST Number (Manitoba) | | Canada | `ca_pst_sk` | Canadian PST Number (Saskatchewan) + /// | | Canada | `ca_qst` | Canadian QST Number (Québec) | | Cape Verde | `cv_nif` + /// | Cape Verde Tax Identification Number (Número de Identificação Fiscal) | | + /// Chile | `cl_tin` | Chilean TIN | | China | `cn_tin` | Chinese Tax ID | | Colombia + /// | `co_nit` | Colombian NIT Number | | Congo-Kinshasa | `cd_nif` | Congo (DR) + /// Tax Identification Number (Número de Identificação Fiscal) | | Costa Rica | + /// `cr_tin` | Costa Rican Tax ID | | Croatia | `eu_vat` | European VAT Number | + /// | Croatia | `hr_oib` | Croatian Personal Identification Number (OIB) | | Cyprus + /// | `eu_vat` | European VAT Number | | Czech Republic | `eu_vat` | European VAT + /// Number | | Denmark | `eu_vat` | European VAT Number | | Dominican Republic + /// | `do_rcn` | Dominican RCN Number | | Ecuador | `ec_ruc` | Ecuadorian RUC Number + /// | | Egypt | `eg_tin` | Egyptian Tax Identification Number | | El Salvador | + /// `sv_nit` | El Salvadorian NIT Number | | Estonia | `eu_vat` | European VAT + /// Number | | Ethiopia | `et_tin` | Ethiopia Tax Identification Number | | European + /// Union | `eu_oss_vat` | European One Stop Shop VAT Number for non-Union scheme + /// | | Finland | `eu_vat` | European VAT Number | | France | `eu_vat` | European + /// VAT Number | | Georgia | `ge_vat` | Georgian VAT | | Germany | `de_stn` | German + /// Tax Number (Steuernummer) | | Germany | `eu_vat` | European VAT Number | | + /// Greece | `eu_vat` | European VAT Number | | Guinea | `gn_nif` | Guinea Tax Identification + /// Number (Número de Identificação Fiscal) | | Hong Kong | `hk_br` | Hong Kong + /// BR Number | | Hungary | `eu_vat` | European VAT Number | | Hungary | `hu_tin` + /// | Hungary Tax Number (adószám) | | Iceland | `is_vat` | Icelandic VAT | | India + /// | `in_gst` | Indian GST Number | | Indonesia | `id_npwp` | Indonesian NPWP + /// Number | | Ireland | `eu_vat` | European VAT Number | | Israel | `il_vat` | + /// Israel VAT | | Italy | `eu_vat` | European VAT Number | | Japan | `jp_cn` | + /// Japanese Corporate Number (*Hōjin Bangō*) | | Japan | `jp_rn` | Japanese Registered + /// Foreign Businesses' Registration Number (*Tōroku Kokugai Jigyōsha no Tōroku + /// Bangō*) | | Japan | `jp_trn` | Japanese Tax Registration Number (*Tōroku Bangō*) + /// | | Kazakhstan | `kz_bin` | Kazakhstani Business Identification Number | | + /// Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + /// | Kyrgyzstan | `kg_tin` | Kyrgyzstan Tax Identification Number | | Laos | `la_tin` + /// | Laos Tax Identification Number | | Latvia | `eu_vat` | European VAT Number + /// | | Liechtenstein | `li_uid` | Liechtensteinian UID Number | | Liechtenstein + /// | `li_vat` | Liechtenstein VAT Number | | Lithuania | `eu_vat` | European VAT + /// Number | | Luxembourg | `eu_vat` | European VAT Number | | Malaysia | `my_frp` + /// | Malaysian FRP Number | | Malaysia | `my_itn` | Malaysian ITN | | Malaysia + /// | `my_sst` | Malaysian SST Number | | Malta | `eu_vat` | European VAT Number + /// | | Mauritania | `mr_nif` | Mauritania Tax Identification Number (Número de + /// Identificação Fiscal) | | Mexico | `mx_rfc` | Mexican RFC Number | | Moldova + /// | `md_vat` | Moldova VAT Number | | Montenegro | `me_pib` | Montenegro PIB + /// Number | | Morocco | `ma_vat` | Morocco VAT Number | | Nepal | `np_pan` | Nepal + /// PAN Number | | Netherlands | `eu_vat` | European VAT Number | | New Zealand + /// | `nz_gst` | New Zealand GST Number | | Nigeria | `ng_tin` | Nigerian Tax Identification + /// Number | | North Macedonia | `mk_vat` | North Macedonia VAT Number | | Northern + /// Ireland | `eu_vat` | Northern Ireland VAT Number | | Norway | `no_vat` | Norwegian + /// VAT Number | | Norway | `no_voec` | Norwegian VAT on e-commerce Number | | Oman + /// | `om_vat` | Omani VAT Number | | Peru | `pe_ruc` | Peruvian RUC Number | | + /// Philippines | `ph_tin` | Philippines Tax Identification Number | | Poland | + /// `eu_vat` | European VAT Number | | Portugal | `eu_vat` | European VAT Number + /// | | Romania | `eu_vat` | European VAT Number | | Romania | `ro_tin` | Romanian + /// Tax ID Number | | Russia | `ru_inn` | Russian INN | | Russia | `ru_kpp` | Russian + /// KPP | | Saudi Arabia | `sa_vat` | Saudi Arabia VAT | | Senegal | `sn_ninea` + /// | Senegal NINEA Number | | Serbia | `rs_pib` | Serbian PIB Number | | Singapore + /// | `sg_gst` | Singaporean GST | | Singapore | `sg_uen` | Singaporean UEN | | + /// Slovakia | `eu_vat` | European VAT Number | | Slovenia | `eu_vat` | European + /// VAT Number | | Slovenia | `si_tin` | Slovenia Tax Number (davčna številka) | + /// | South Africa | `za_vat` | South African VAT Number | | South Korea | `kr_brn` + /// | Korean BRN | | Spain | `es_cif` | Spanish NIF Number (previously Spanish + /// CIF Number) | | Spain | `eu_vat` | European VAT Number | | Suriname | `sr_fin` + /// | Suriname FIN Number | | Sweden | `eu_vat` | European VAT Number | | Switzerland + /// | `ch_uid` | Switzerland UID Number | | Switzerland | `ch_vat` | Switzerland + /// VAT Number | | Taiwan | `tw_vat` | Taiwanese VAT | | Tajikistan | `tj_tin` + /// | Tajikistan Tax Identification Number | | Tanzania | `tz_vat` | Tanzania VAT + /// Number | | Thailand | `th_vat` | Thai VAT | | Turkey | `tr_tin` | Turkish Tax + /// Identification Number | | Uganda | `ug_tin` | Uganda Tax Identification Number + /// | | Ukraine | `ua_vat` | Ukrainian VAT | | United Arab Emirates | `ae_trn` | + /// United Arab Emirates TRN | | United Kingdom | `gb_vat` | United Kingdom VAT + /// Number | | United States | `us_ein` | United States EIN | | Uruguay | `uy_ruc` + /// | Uruguayan RUC Number | | Uzbekistan | `uz_tin` | Uzbekistan TIN Number | + /// | Uzbekistan | `uz_vat` | Uzbekistan VAT Number | | Venezuela | `ve_rif` | + /// Venezuelan RIF Number | | Vietnam | `vn_tin` | Vietnamese Tax ID Number | | + /// Zambia | `zm_tin` | Zambia Tax Identification Number | | Zimbabwe | `zw_tin` + /// | Zimbabwe Tax Identification Number | /// public required Models::CustomerTaxID? CustomerTaxID { get { - if (!this.Properties.TryGetValue("customer_tax_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer_tax_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer_tax_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_tax_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_tax_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,36 +302,35 @@ public required string Currency /// provided, the first discount in the list will be returned. If the list is empty, /// `None` will be returned. /// - public required Json::JsonElement Discount + public required JsonElement Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List Discounts + public required List Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discounts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("discounts"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("discounts"); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -350,15 +341,15 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("due_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("due_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "due_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["due_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["due_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -370,20 +361,15 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("eligible_to_issue_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("eligible_to_issue_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "eligible_to_issue_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["eligible_to_issue_at"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["eligible_to_issue_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -394,18 +380,15 @@ public required string? HostedInvoiceURL { get { - if (!this.Properties.TryGetValue("hosted_invoice_url", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("hosted_invoice_url", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "hosted_invoice_url", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["hosted_invoice_url"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["hosted_invoice_url"] = JsonSerializer.SerializeToElement(value); } } /// @@ -417,16 +400,16 @@ public required string InvoiceNumber { get { - if (!this.Properties.TryGetValue("invoice_number", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("invoice_number"); } - set { this.Properties["invoice_number"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_number"] = JsonSerializer.SerializeToElement(value); } } /// @@ -436,32 +419,32 @@ public required string? InvoicePdf { get { - if (!this.Properties.TryGetValue("invoice_pdf", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_pdf", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_pdf", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice_pdf"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_pdf"] = JsonSerializer.SerializeToElement(value); } } public required InvoiceFetchUpcomingResponseProperties::InvoiceSource InvoiceSource { get { - if (!this.Properties.TryGetValue("invoice_source", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_source", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice_source", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("invoice_source"); } - set { this.Properties["invoice_source"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice_source"] = JsonSerializer.SerializeToElement(value); } } /// @@ -472,15 +455,15 @@ public required string? InvoicePdf { get { - if (!this.Properties.TryGetValue("issue_failed_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("issue_failed_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "issue_failed_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["issue_failed_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["issue_failed_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -491,65 +474,65 @@ public required string? InvoicePdf { get { - if (!this.Properties.TryGetValue("issued_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("issued_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "issued_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["issued_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["issued_at"] = JsonSerializer.SerializeToElement(value); } } /// /// The breakdown of prices in this invoice. /// - public required Generic::List LineItems + public required List LineItems { get { - if (!this.Properties.TryGetValue("line_items", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("line_items", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("line_items"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("line_items"); } - set { this.Properties["line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["line_items"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -559,12 +542,12 @@ public required string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) throw new System::ArgumentOutOfRangeException("memo", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } /// @@ -573,50 +556,50 @@ public required string? Memo /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -627,38 +610,35 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("paid_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("paid_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "paid_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["paid_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["paid_at"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of payment attempts associated with the invoice /// - public required Generic::List PaymentAttempts + public required List PaymentAttempts { get { - if (!this.Properties.TryGetValue("payment_attempts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_attempts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_attempts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("payment_attempts"); - } - set - { - this.Properties["payment_attempts"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("payment_attempts"); } + set { this.Properties["payment_attempts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -669,18 +649,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("payment_failed_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_failed_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_failed_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_failed_at"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_failed_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -692,18 +669,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("payment_started_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_started_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_started_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_started_at"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_started_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -714,68 +688,62 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("scheduled_issue_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("scheduled_issue_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "scheduled_issue_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["scheduled_issue_at"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["scheduled_issue_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Address? ShippingAddress { get { - if (!this.Properties.TryGetValue("shipping_address", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("shipping_address", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "shipping_address", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["shipping_address"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["shipping_address"] = JsonSerializer.SerializeToElement(value); } } public required InvoiceFetchUpcomingResponseProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required Models::SubscriptionMinified? Subscription { get { - if (!this.Properties.TryGetValue("subscription", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subscription", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subscription", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["subscription"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); } } /// @@ -785,16 +753,16 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -806,15 +774,15 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("sync_failed_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("sync_failed_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "sync_failed_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["sync_failed_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["sync_failed_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -824,15 +792,15 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("target_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("target_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "target_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["target_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["target_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -842,13 +810,13 @@ public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } /// @@ -859,15 +827,15 @@ public required string Total { get { - if (!this.Properties.TryGetValue("voided_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["voided_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["voided_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -878,15 +846,15 @@ public required bool WillAutoIssue { get { - if (!this.Properties.TryGetValue("will_auto_issue", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("will_auto_issue", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "will_auto_issue", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["will_auto_issue"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["will_auto_issue"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -955,15 +923,15 @@ public override void Validate() public InvoiceFetchUpcomingResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceFetchUpcomingResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceFetchUpcomingResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static InvoiceFetchUpcomingResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/AutoCollection.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/AutoCollection.cs index ad180830..b85e8cd9 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/AutoCollection.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/AutoCollection.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AutoCollection : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AutoCollection : ModelBase, IFromRaw { /// /// True only if auto-collection is enabled for this invoice. @@ -17,15 +16,15 @@ public required bool? Enabled { get { - if (!this.Properties.TryGetValue("enabled", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("enabled", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "enabled", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["enabled"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["enabled"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +36,15 @@ public required bool? Enabled { get { - if (!this.Properties.TryGetValue("next_attempt_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("next_attempt_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "next_attempt_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["next_attempt_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["next_attempt_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -55,15 +54,15 @@ public required long? NumAttempts { get { - if (!this.Properties.TryGetValue("num_attempts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("num_attempts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "num_attempts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["num_attempts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["num_attempts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,24 +77,17 @@ public required long? NumAttempts { get { - if ( - !this.Properties.TryGetValue( - "previously_attempted_at", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("previously_attempted_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "previously_attempted_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["previously_attempted_at"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["previously_attempted_at"] = JsonSerializer.SerializeToElement(value); } } @@ -110,16 +102,14 @@ public override void Validate() public AutoCollection() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AutoCollection(Generic::Dictionary properties) + [SetsRequiredMembers] + AutoCollection(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AutoCollection FromRawUnchecked( - Generic::Dictionary properties - ) + public static AutoCollection FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CreditNote.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CreditNote1.cs similarity index 52% rename from src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CreditNote.cs rename to src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CreditNote1.cs index 6733402e..0d212d35 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CreditNote.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CreditNote1.cs @@ -1,45 +1,41 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CreditNote : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CreditNote1 : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string CreditNoteNumber { get { - if (!this.Properties.TryGetValue("credit_note_number", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note_number", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note_number", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credit_note_number"); } - set - { - this.Properties["credit_note_number"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["credit_note_number"] = JsonSerializer.SerializeToElement(value); } } /// @@ -49,54 +45,54 @@ public required string? Memo { get { - if (!this.Properties.TryGetValue("memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("memo", out JsonElement element)) throw new System::ArgumentOutOfRangeException("memo", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["memo"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["memo"] = JsonSerializer.SerializeToElement(value); } } public required string Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("reason"); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } public required string Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -107,15 +103,15 @@ public required string Type { get { - if (!this.Properties.TryGetValue("voided_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("voided_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "voided_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["voided_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["voided_at"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -129,19 +125,17 @@ public override void Validate() _ = this.VoidedAt; } - public CreditNote() { } + public CreditNote1() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CreditNote(Generic::Dictionary properties) + [SetsRequiredMembers] + CreditNote1(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CreditNote FromRawUnchecked( - Generic::Dictionary properties - ) + public static CreditNote1 FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransaction.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransaction.cs index 9911dff2..2b3f1a8a 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransaction.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransaction.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CustomerBalanceTransactionProperties = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.CustomerBalanceTransactionProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class CustomerBalanceTransaction - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// A unique id for this transaction. @@ -21,30 +19,29 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required CustomerBalanceTransactionProperties::Action Action { get { - if (!this.Properties.TryGetValue("action", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("action", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "action", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("action"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("action"); } - set { this.Properties["action"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["action"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,16 +51,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,30 +70,30 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required Models::CreditNoteTiny? CreditNote + public required CreditNoteTiny? CreditNote { get { - if (!this.Properties.TryGetValue("credit_note", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credit_note", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credit_note", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["credit_note"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credit_note"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,15 +103,15 @@ public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,31 +121,31 @@ public required string EndingBalance { get { - if (!this.Properties.TryGetValue("ending_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("ending_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "ending_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("ending_balance"); } - set { this.Properties["ending_balance"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["ending_balance"] = JsonSerializer.SerializeToElement(value); } } - public required Models::InvoiceTiny? Invoice + public required InvoiceTiny? Invoice { get { - if (!this.Properties.TryGetValue("invoice", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoice", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["invoice"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["invoice"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,33 +156,29 @@ public required string StartingBalance { get { - if (!this.Properties.TryGetValue("starting_balance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("starting_balance", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "starting_balance", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("starting_balance"); } - set - { - this.Properties["starting_balance"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["starting_balance"] = JsonSerializer.SerializeToElement(value); } } public required CustomerBalanceTransactionProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -205,15 +198,15 @@ public override void Validate() public CustomerBalanceTransaction() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CustomerBalanceTransaction(Generic::Dictionary properties) + [SetsRequiredMembers] + CustomerBalanceTransaction(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static CustomerBalanceTransaction FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Action.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Action.cs index b7364296..e231853f 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Action.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Action.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.CustomerBalanceTransactionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Action(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Action(string value) : IEnum { public static readonly Action AppliedToInvoice = new("applied_to_invoice"); diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Type.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Type.cs index b5cc69e4..0c6abd75 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Type.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/CustomerBalanceTransactionProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.CustomerBalanceTransactionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Increment = new("increment"); diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/InvoiceSource.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/InvoiceSource.cs index ce1f281f..892d5d68 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/InvoiceSource.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/InvoiceSource.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class InvoiceSource(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class InvoiceSource(string value) : IEnum { public static readonly InvoiceSource Subscription = new("subscription"); diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItem.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItem.cs index b8954e9f..a5db3711 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItem.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItem.cs @@ -1,16 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using LineItemProperties = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class LineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class LineItem : ModelBase, IFromRaw { /// /// A unique ID for this line item. @@ -19,13 +18,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,19 +35,16 @@ public required string AdjustedSubtotal { get { - if (!this.Properties.TryGetValue("adjusted_subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjusted_subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjusted_subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("adjusted_subtotal"); } - set - { - this.Properties["adjusted_subtotal"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["adjusted_subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -56,21 +52,20 @@ public required string AdjustedSubtotal /// on invoice calculations (ie. usage discounts -> amount discounts -> percentage /// discounts -> minimums -> maximums). /// - public required Generic::List Adjustments + public required List Adjustments { get { - if (!this.Properties.TryGetValue("adjustments", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustments", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustments", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustments"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("adjustments"); } - set { this.Properties["adjustments"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustments"] = JsonSerializer.SerializeToElement(value); } } /// @@ -81,16 +76,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -100,34 +95,34 @@ public required string CreditsApplied { get { - if (!this.Properties.TryGetValue("credits_applied", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("credits_applied", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "credits_applied", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("credits_applied"); } - set { this.Properties["credits_applied"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["credits_applied"] = JsonSerializer.SerializeToElement(value); } } /// /// This field is deprecated in favor of `adjustments` /// - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +132,15 @@ public required string CreditsApplied { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,15 +150,15 @@ public required string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filter", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,15 +170,15 @@ public required string? Grouping { get { - if (!this.Properties.TryGetValue("grouping", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouping", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["grouping"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping"] = JsonSerializer.SerializeToElement(value); } } /// @@ -193,15 +188,15 @@ public required string? Grouping { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } /// @@ -211,15 +206,15 @@ public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -229,15 +224,15 @@ public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } /// @@ -247,15 +242,15 @@ public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -265,13 +260,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -281,25 +276,18 @@ public required string PartiallyInvoicedAmount { get { - if ( - !this.Properties.TryGetValue( - "partially_invoiced_amount", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("partially_invoiced_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "partially_invoiced_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("partially_invoiced_amount"); } set { - this.Properties["partially_invoiced_amount"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["partially_invoiced_amount"] = JsonSerializer.SerializeToElement(value); } } @@ -318,13 +306,13 @@ public required string PartiallyInvoicedAmount { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) throw new System::ArgumentOutOfRangeException("price", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price"); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -334,15 +322,15 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -352,35 +340,34 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// /// For complex pricing structures, the line item can be broken down further in `sub_line_items`. /// - public required Generic::List SubLineItems + public required List SubLineItems { get { - if (!this.Properties.TryGetValue("sub_line_items", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("sub_line_items", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "sub_line_items", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("sub_line_items"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("sub_line_items"); } - set { this.Properties["sub_line_items"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["sub_line_items"] = JsonSerializer.SerializeToElement(value); } } /// @@ -390,57 +377,54 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// /// An array of tax rates and their incurred tax amounts. Empty if no tax integration /// is configured. /// - public required Generic::List TaxAmounts + public required List TaxAmounts { get { - if (!this.Properties.TryGetValue("tax_amounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_amounts", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_amounts", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tax_amounts"); } - set { this.Properties["tax_amounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tax_amounts"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of customer ids that were used to calculate the usage for this line item. /// - public required Generic::List? UsageCustomerIDs + public required List? UsageCustomerIDs { get { - if (!this.Properties.TryGetValue("usage_customer_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_customer_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_customer_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -484,16 +468,14 @@ public override void Validate() public LineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - LineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + LineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static LineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static LineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/Adjustment.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/Adjustment.cs index 25df9180..fafbc0fa 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/Adjustment.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/Adjustment.cs @@ -1,34 +1,27 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::MonetaryUsageDiscountAdjustment Create( - Models::MonetaryUsageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryUsageDiscountAdjustment value) => + new AdjustmentVariants::MonetaryUsageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryAmountDiscountAdjustment Create( - Models::MonetaryAmountDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryAmountDiscountAdjustment value) => + new AdjustmentVariants::MonetaryAmountDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryPercentageDiscountAdjustment Create( - Models::MonetaryPercentageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryPercentageDiscountAdjustment value) => + new AdjustmentVariants::MonetaryPercentageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryMinimumAdjustment Create( - Models::MonetaryMinimumAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryMinimumAdjustment value) => + new AdjustmentVariants::MonetaryMinimumAdjustmentVariant(value); - public static AdjustmentVariants::MonetaryMaximumAdjustment Create( - Models::MonetaryMaximumAdjustment value - ) => new(value); + public static implicit operator Adjustment(MonetaryMaximumAdjustment value) => + new AdjustmentVariants::MonetaryMaximumAdjustmentVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/AdjustmentVariants/All.cs index 12ad7673..78cba40c 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/AdjustmentVariants/All.cs @@ -1,25 +1,18 @@ -using LineItemProperties = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryUsageDiscountAdjustment, - Models::MonetaryUsageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryUsageDiscountAdjustmentVariant, + MonetaryUsageDiscountAdjustment >) )] -public sealed record class MonetaryUsageDiscountAdjustment( - Models::MonetaryUsageDiscountAdjustment Value -) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryUsageDiscountAdjustmentVariant( + MonetaryUsageDiscountAdjustment Value +) : Adjustment, IVariant { - public static MonetaryUsageDiscountAdjustment From( - Models::MonetaryUsageDiscountAdjustment value - ) + public static MonetaryUsageDiscountAdjustmentVariant From(MonetaryUsageDiscountAdjustment value) { return new(value); } @@ -30,20 +23,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryAmountDiscountAdjustment, - Models::MonetaryAmountDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryAmountDiscountAdjustmentVariant, + MonetaryAmountDiscountAdjustment >) )] -public sealed record class MonetaryAmountDiscountAdjustment( - Models::MonetaryAmountDiscountAdjustment Value -) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryAmountDiscountAdjustmentVariant( + MonetaryAmountDiscountAdjustment Value +) : Adjustment, IVariant { - public static MonetaryAmountDiscountAdjustment From( - Models::MonetaryAmountDiscountAdjustment value + public static MonetaryAmountDiscountAdjustmentVariant From( + MonetaryAmountDiscountAdjustment value ) { return new(value); @@ -55,23 +46,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - MonetaryPercentageDiscountAdjustment, - Models::MonetaryPercentageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + MonetaryPercentageDiscountAdjustmentVariant, + MonetaryPercentageDiscountAdjustment >) )] -public sealed record class MonetaryPercentageDiscountAdjustment( - Models::MonetaryPercentageDiscountAdjustment Value +public sealed record class MonetaryPercentageDiscountAdjustmentVariant( + MonetaryPercentageDiscountAdjustment Value ) - : LineItemProperties::Adjustment, - Orb::IVariant< - MonetaryPercentageDiscountAdjustment, - Models::MonetaryPercentageDiscountAdjustment - > + : Adjustment, + IVariant { - public static MonetaryPercentageDiscountAdjustment From( - Models::MonetaryPercentageDiscountAdjustment value + public static MonetaryPercentageDiscountAdjustmentVariant From( + MonetaryPercentageDiscountAdjustment value ) { return new(value); @@ -83,14 +71,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class MonetaryMinimumAdjustment(Models::MonetaryMinimumAdjustment Value) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryMinimumAdjustmentVariant(MonetaryMinimumAdjustment Value) + : Adjustment, + IVariant { - public static MonetaryMinimumAdjustment From(Models::MonetaryMinimumAdjustment value) + public static MonetaryMinimumAdjustmentVariant From(MonetaryMinimumAdjustment value) { return new(value); } @@ -101,14 +89,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class MonetaryMaximumAdjustment(Models::MonetaryMaximumAdjustment Value) - : LineItemProperties::Adjustment, - Orb::IVariant +public sealed record class MonetaryMaximumAdjustmentVariant(MonetaryMaximumAdjustment Value) + : Adjustment, + IVariant { - public static MonetaryMaximumAdjustment From(Models::MonetaryMaximumAdjustment value) + public static MonetaryMaximumAdjustmentVariant From(MonetaryMaximumAdjustment value) { return new(value); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItem.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItem.cs index 1f8142e4..4a36bd5f 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItem.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItem.cs @@ -1,23 +1,21 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using SubLineItemVariants = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties.SubLineItemVariants; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class SubLineItem { internal SubLineItem() { } - public static SubLineItemVariants::MatrixSubLineItem Create(Models::MatrixSubLineItem value) => - new(value); + public static implicit operator SubLineItem(MatrixSubLineItem value) => + new SubLineItemVariants::MatrixSubLineItemVariant(value); - public static SubLineItemVariants::TierSubLineItem Create(Models::TierSubLineItem value) => - new(value); + public static implicit operator SubLineItem(TierSubLineItem value) => + new SubLineItemVariants::TierSubLineItemVariant(value); - public static SubLineItemVariants::OtherSubLineItem Create(Models::OtherSubLineItem value) => - new(value); + public static implicit operator SubLineItem(OtherSubLineItem value) => + new SubLineItemVariants::OtherSubLineItemVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItemVariants/All.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItemVariants/All.cs index d362c779..747b0ba7 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItemVariants/All.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/LineItemProperties/SubLineItemVariants/All.cs @@ -1,18 +1,13 @@ -using LineItemProperties = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.LineItemProperties.SubLineItemVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class MatrixSubLineItem(Models::MatrixSubLineItem Value) - : LineItemProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class MatrixSubLineItemVariant(MatrixSubLineItem Value) + : SubLineItem, + IVariant { - public static MatrixSubLineItem From(Models::MatrixSubLineItem value) + public static MatrixSubLineItemVariant From(MatrixSubLineItem value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class TierSubLineItem(Models::TierSubLineItem Value) - : LineItemProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class TierSubLineItemVariant(TierSubLineItem Value) + : SubLineItem, + IVariant { - public static TierSubLineItem From(Models::TierSubLineItem value) + public static TierSubLineItemVariant From(TierSubLineItem value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class OtherSubLineItem(Models::OtherSubLineItem Value) - : LineItemProperties::SubLineItem, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class OtherSubLineItemVariant(OtherSubLineItem Value) + : SubLineItem, + IVariant { - public static OtherSubLineItem From(Models::OtherSubLineItem value) + public static OtherSubLineItemVariant From(OtherSubLineItem value) { return new(value); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttempt.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttempt.cs index 5eb9cd5f..80e0c9ef 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttempt.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttempt.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PaymentAttemptProperties = Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.PaymentAttemptProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PaymentAttempt : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PaymentAttempt : ModelBase, IFromRaw { /// /// The ID of the payment attempt. @@ -18,13 +17,13 @@ public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,16 +33,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,15 +52,15 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,20 +70,15 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("payment_provider", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_provider", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_provider", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); - } - set - { - this.Properties["payment_provider"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_provider"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,18 +88,15 @@ public required string? PaymentProviderID { get { - if (!this.Properties.TryGetValue("payment_provider_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("payment_provider_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_provider_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["payment_provider_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["payment_provider_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -115,15 +106,15 @@ public required bool Succeeded { get { - if (!this.Properties.TryGetValue("succeeded", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("succeeded", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "succeeded", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["succeeded"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["succeeded"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -139,16 +130,14 @@ public override void Validate() public PaymentAttempt() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PaymentAttempt(Generic::Dictionary properties) + [SetsRequiredMembers] + PaymentAttempt(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PaymentAttempt FromRawUnchecked( - Generic::Dictionary properties - ) + public static PaymentAttempt FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttemptProperties/PaymentProvider.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttemptProperties/PaymentProvider.cs index 23349cdd..3bcafdfe 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttemptProperties/PaymentProvider.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/PaymentAttemptProperties/PaymentProvider.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties.PaymentAttemptProperties; /// /// The payment provider that attempted to collect the payment. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PaymentProvider(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PaymentProvider(string value) : IEnum { public static readonly PaymentProvider Stripe = new("stripe"); @@ -23,7 +22,7 @@ public Value Known() => _value switch { "stripe" => Value.Stripe, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/Status.cs b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/Status.cs index 7b9371a7..927591b7 100644 --- a/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/Status.cs +++ b/src/Orb/Models/Invoices/InvoiceFetchUpcomingResponseProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices.InvoiceFetchUpcomingResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Issued = new("issued"); diff --git a/src/Orb/Models/Invoices/InvoiceIssueParams.cs b/src/Orb/Models/Invoices/InvoiceIssueParams.cs index 09969b8f..a8495641 100644 --- a/src/Orb/Models/Invoices/InvoiceIssueParams.cs +++ b/src/Orb/Models/Invoices/InvoiceIssueParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Invoices; @@ -14,9 +13,9 @@ namespace Orb.Models.Invoices; /// trigger side effects, some of which could be customer-visible (e.g. sending emails, /// auto-collecting payment, syncing the invoice to external providers, etc). /// -public sealed record class InvoiceIssueParams : Orb::ParamsBase +public sealed record class InvoiceIssueParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string InvoiceID; @@ -31,15 +30,15 @@ public bool? Synchronous { get { - if (!this.BodyProperties.TryGetValue("synchronous", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("synchronous", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["synchronous"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["synchronous"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -50,21 +49,21 @@ public bool? Synchronous }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceListPageResponse.cs b/src/Orb/Models/Invoices/InvoiceListPageResponse.cs index 9d5f9de9..3a9df708 100644 --- a/src/Orb/Models/Invoices/InvoiceListPageResponse.cs +++ b/src/Orb/Models/Invoices/InvoiceListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Invoices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class InvoiceListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class InvoiceListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,15 +51,15 @@ public override void Validate() public InvoiceListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - InvoiceListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + InvoiceListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static InvoiceListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Invoices/InvoiceListParams.cs b/src/Orb/Models/Invoices/InvoiceListParams.cs index 1df26485..2b16776f 100644 --- a/src/Orb/Models/Invoices/InvoiceListParams.cs +++ b/src/Orb/Models/Invoices/InvoiceListParams.cs @@ -1,8 +1,7 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; +using System.Collections.Generic; +using System.Net.Http; +using System.Text.Json; using InvoiceListParamsProperties = Orb.Models.Invoices.InvoiceListParamsProperties; -using Json = System.Text.Json; -using Orb = Orb; using System = System; namespace Orb.Models.Invoices; @@ -21,42 +20,42 @@ namespace Orb.Models.Invoices; /// for each draft invoice, which may not always be up-to-date since Orb regularly /// refreshes invoices asynchronously. /// -public sealed record class InvoiceListParams : Orb::ParamsBase +public sealed record class InvoiceListParams : ParamsBase { public string? Amount { get { - if (!this.QueryProperties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["amount"] = JsonSerializer.SerializeToElement(value); } } public string? AmountGt { get { - if (!this.QueryProperties.TryGetValue("amount[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("amount[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["amount[gt]"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["amount[gt]"] = JsonSerializer.SerializeToElement(value); } } public string? AmountLt { get { - if (!this.QueryProperties.TryGetValue("amount[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("amount[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["amount[lt]"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["amount[lt]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -67,53 +66,48 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } public string? CustomerID { get { - if (!this.QueryProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } public InvoiceListParamsProperties::DateType? DateType { get { - if (!this.QueryProperties.TryGetValue("date_type", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("date_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["date_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["date_type"] = JsonSerializer.SerializeToElement(value); } } public System::DateOnly? DueDate { get { - if (!this.QueryProperties.TryGetValue("due_date", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("due_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["due_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["due_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -126,68 +120,50 @@ public string? DueDateWindow { get { - if (!this.QueryProperties.TryGetValue("due_date_window", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("due_date_window", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["due_date_window"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["due_date_window"] = JsonSerializer.SerializeToElement(value); } } public System::DateOnly? DueDateGt { get { - if (!this.QueryProperties.TryGetValue("due_date[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("due_date[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["due_date[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["due_date[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateOnly? DueDateLt { get { - if (!this.QueryProperties.TryGetValue("due_date[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("due_date[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["due_date[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["due_date[lt]"] = JsonSerializer.SerializeToElement(value); } } public string? ExternalCustomerID { get { - if ( - !this.QueryProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -195,40 +171,26 @@ public string? ExternalCustomerID { get { - if ( - !this.QueryProperties.TryGetValue("invoice_date[gt]", out Json::JsonElement element) - ) + if (!this.QueryProperties.TryGetValue("invoice_date[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["invoice_date[gt]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["invoice_date[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? InvoiceDateGte { get { - if ( - !this.QueryProperties.TryGetValue( - "invoice_date[gte]", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("invoice_date[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["invoice_date[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["invoice_date[gte]"] = JsonSerializer.SerializeToElement(value); } } @@ -236,40 +198,26 @@ public string? ExternalCustomerID { get { - if ( - !this.QueryProperties.TryGetValue("invoice_date[lt]", out Json::JsonElement element) - ) + if (!this.QueryProperties.TryGetValue("invoice_date[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["invoice_date[lt]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["invoice_date[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? InvoiceDateLte { get { - if ( - !this.QueryProperties.TryGetValue( - "invoice_date[lte]", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("invoice_date[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["invoice_date[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["invoice_date[lte]"] = JsonSerializer.SerializeToElement(value); } } @@ -277,15 +225,12 @@ public bool? IsRecurring { get { - if (!this.QueryProperties.TryGetValue("is_recurring", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("is_recurring", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["is_recurring"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["is_recurring"] = JsonSerializer.SerializeToElement(value); } } /// @@ -295,46 +240,39 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public Generic::List? Status + public List? Status { get { - if (!this.QueryProperties.TryGetValue("status", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.QueryProperties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["status"] = JsonSerializer.SerializeToElement(value); } } public string? SubscriptionID { get { - if (!this.QueryProperties.TryGetValue("subscription_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("subscription_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["subscription_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["subscription_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/invoices") { @@ -342,12 +280,12 @@ public string? SubscriptionID }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceListParamsProperties/DateType.cs b/src/Orb/Models/Invoices/InvoiceListParamsProperties/DateType.cs index 8100e75b..9e409d1d 100644 --- a/src/Orb/Models/Invoices/InvoiceListParamsProperties/DateType.cs +++ b/src/Orb/Models/Invoices/InvoiceListParamsProperties/DateType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceListParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DateType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DateType(string value) : IEnum { public static readonly DateType DueDate = new("due_date"); @@ -24,7 +23,7 @@ public Value Known() => { "due_date" => Value.DueDate, "invoice_date" => Value.InvoiceDate, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Invoices/InvoiceListParamsProperties/Status.cs b/src/Orb/Models/Invoices/InvoiceListParamsProperties/Status.cs index 5639e972..d1b3170e 100644 --- a/src/Orb/Models/Invoices/InvoiceListParamsProperties/Status.cs +++ b/src/Orb/Models/Invoices/InvoiceListParamsProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Invoices.InvoiceListParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Draft = new("draft"); @@ -36,7 +35,7 @@ public Value Known() => "paid" => Value.Paid, "synced" => Value.Synced, "void" => Value.Void, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Invoices/InvoiceMarkPaidParams.cs b/src/Orb/Models/Invoices/InvoiceMarkPaidParams.cs index 7e939afa..1b9452f8 100644 --- a/src/Orb/Models/Invoices/InvoiceMarkPaidParams.cs +++ b/src/Orb/Models/Invoices/InvoiceMarkPaidParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Invoices; @@ -11,9 +10,9 @@ namespace Orb.Models.Invoices; /// This endpoint allows an invoice's status to be set the `paid` status. This can /// only be done to invoices that are in the `issued` status. /// -public sealed record class InvoiceMarkPaidParams : Orb::ParamsBase +public sealed record class InvoiceMarkPaidParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string InvoiceID; @@ -24,24 +23,17 @@ public sealed record class InvoiceMarkPaidParams : Orb::ParamsBase { get { - if ( - !this.BodyProperties.TryGetValue( - "payment_received_date", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("payment_received_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "payment_received_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["payment_received_date"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["payment_received_date"] = JsonSerializer.SerializeToElement(value); } } @@ -52,12 +44,12 @@ public string? ExternalID { get { - if (!this.BodyProperties.TryGetValue("external_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("external_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["external_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["external_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -67,15 +59,15 @@ public string? Notes { get { - if (!this.BodyProperties.TryGetValue("notes", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("notes", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["notes"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["notes"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -86,21 +78,21 @@ public string? Notes }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoicePayParams.cs b/src/Orb/Models/Invoices/InvoicePayParams.cs index 59feb9b4..f83efcc9 100644 --- a/src/Orb/Models/Invoices/InvoicePayParams.cs +++ b/src/Orb/Models/Invoices/InvoicePayParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Invoices; @@ -8,11 +7,11 @@ namespace Orb.Models.Invoices; /// This endpoint collects payment for an invoice using the customer's default payment /// method. This action can only be taken on invoices with status "issued". /// -public sealed record class InvoicePayParams : Orb::ParamsBase +public sealed record class InvoicePayParams : ParamsBase { public required string InvoiceID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -23,12 +22,12 @@ public sealed record class InvoicePayParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceUpdateParams.cs b/src/Orb/Models/Invoices/InvoiceUpdateParams.cs index ce5bb160..09d47555 100644 --- a/src/Orb/Models/Invoices/InvoiceUpdateParams.cs +++ b/src/Orb/Models/Invoices/InvoiceUpdateParams.cs @@ -1,22 +1,22 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Invoices; /// -/// This endpoint allows you to update the `metadata` property on an invoice. If -/// you pass null for the metadata value, it will clear any existing metadata for -/// that invoice. +/// This endpoint allows you to update the `metadata`, `net_terms`, and `due_date` +/// properties on an invoice. If you pass null for the metadata value, it will clear +/// any existing metadata for that invoice. /// -/// `metadata` can be modified regardless of invoice state. +/// `metadata` can be modified regardless of invoice state. `net_terms` and `due_date` +/// can only be modified if the invoice is in a `draft` state. /// -public sealed record class InvoiceUpdateParams : Orb::ParamsBase +public sealed record class InvoiceUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string InvoiceID; @@ -25,19 +25,19 @@ public sealed record class InvoiceUpdateParams : Orb::ParamsBase /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/invoices/{0}", this.InvoiceID) @@ -47,21 +47,21 @@ public sealed record class InvoiceUpdateParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Invoices/InvoiceVoidParams.cs b/src/Orb/Models/Invoices/InvoiceVoidParams.cs index 4090942c..42a7bbe9 100644 --- a/src/Orb/Models/Invoices/InvoiceVoidParams.cs +++ b/src/Orb/Models/Invoices/InvoiceVoidParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Invoices; @@ -17,11 +16,11 @@ namespace Orb.Models.Invoices; /// paid, the credit block will be voided. If the invoice was created due to a top-up, /// the top-up will be disabled. /// -public sealed record class InvoiceVoidParams : Orb::ParamsBase +public sealed record class InvoiceVoidParams : ParamsBase { public required string InvoiceID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -32,12 +31,12 @@ public sealed record class InvoiceVoidParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/ItemSlim.cs b/src/Orb/Models/ItemSlim.cs index 47f856fe..3e252af4 100644 --- a/src/Orb/Models/ItemSlim.cs +++ b/src/Orb/Models/ItemSlim.cs @@ -1,39 +1,38 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ItemSlim : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ItemSlim : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -45,16 +44,14 @@ public override void Validate() public ItemSlim() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ItemSlim(Generic::Dictionary properties) + [SetsRequiredMembers] + ItemSlim(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ItemSlim FromRawUnchecked( - Generic::Dictionary properties - ) + public static ItemSlim FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Items/Item.cs b/src/Orb/Models/Items/Item.cs index 11c3e4e3..0ac919a9 100644 --- a/src/Orb/Models/Items/Item.cs +++ b/src/Orb/Models/Items/Item.cs @@ -1,10 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ItemProperties = Orb.Models.Items.ItemProperties; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Items; @@ -13,57 +12,48 @@ namespace Orb.Models.Items; /// with all line items, billable metrics, and prices and are used for defining external /// sync behavior for invoices and tax calculation purposes. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Item : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Item : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List ExternalConnections + public required List ExternalConnections { get { - if (!this.Properties.TryGetValue("external_connections", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_connections", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_connections", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("external_connections"); - } - set - { - this.Properties["external_connections"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("external_connections"); } + set { this.Properties["external_connections"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,33 +62,30 @@ public required string ID /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -119,14 +106,14 @@ public override void Validate() public Item() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Item(Generic::Dictionary properties) + [SetsRequiredMembers] + Item(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Item FromRawUnchecked(Generic::Dictionary properties) + public static Item FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Items/ItemArchiveParams.cs b/src/Orb/Models/Items/ItemArchiveParams.cs index 3a0a7671..d76a8e04 100644 --- a/src/Orb/Models/Items/ItemArchiveParams.cs +++ b/src/Orb/Models/Items/ItemArchiveParams.cs @@ -1,19 +1,18 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Items; /// /// Archive item /// -public sealed record class ItemArchiveParams : Orb::ParamsBase +public sealed record class ItemArchiveParams : ParamsBase { public required string ItemID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/items/{0}/archive", this.ItemID) ) @@ -22,12 +21,12 @@ public sealed record class ItemArchiveParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Items/ItemCreateParams.cs b/src/Orb/Models/Items/ItemCreateParams.cs index 6ab77db2..995121fb 100644 --- a/src/Orb/Models/Items/ItemCreateParams.cs +++ b/src/Orb/Models/Items/ItemCreateParams.cs @@ -1,18 +1,17 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Items; /// /// This endpoint is used to create an [Item](/core-concepts#item). /// -public sealed record class ItemCreateParams : Orb::ParamsBase +public sealed record class ItemCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// The name of the item. @@ -21,13 +20,13 @@ public required string Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,41 +34,41 @@ public required string Name /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/items") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/items") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Items/ItemFetchParams.cs b/src/Orb/Models/Items/ItemFetchParams.cs index b606ff77..3264ba62 100644 --- a/src/Orb/Models/Items/ItemFetchParams.cs +++ b/src/Orb/Models/Items/ItemFetchParams.cs @@ -1,19 +1,18 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Items; /// /// This endpoint returns an item identified by its item_id. /// -public sealed record class ItemFetchParams : Orb::ParamsBase +public sealed record class ItemFetchParams : ParamsBase { public required string ItemID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/items/{0}", this.ItemID) ) { @@ -21,12 +20,12 @@ public sealed record class ItemFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Items/ItemListPageResponse.cs b/src/Orb/Models/Items/ItemListPageResponse.cs index c1825aaf..9f3ec794 100644 --- a/src/Orb/Models/Items/ItemListPageResponse.cs +++ b/src/Orb/Models/Items/ItemListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Items; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ItemListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ItemListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +51,14 @@ public override void Validate() public ItemListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ItemListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + ItemListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ItemListPageResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static ItemListPageResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Items/ItemListParams.cs b/src/Orb/Models/Items/ItemListParams.cs index 24037e62..8f48b889 100644 --- a/src/Orb/Models/Items/ItemListParams.cs +++ b/src/Orb/Models/Items/ItemListParams.cs @@ -1,14 +1,13 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Items; /// /// This endpoint returns a list of all Items, ordered in descending order by creation time. /// -public sealed record class ItemListParams : Orb::ParamsBase +public sealed record class ItemListParams : ParamsBase { /// /// Cursor for pagination. This can be populated by the `next_cursor` value returned @@ -18,12 +17,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -33,28 +32,28 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/items") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/items") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Items/ItemProperties/ExternalConnection.cs b/src/Orb/Models/Items/ItemProperties/ExternalConnection.cs index 3102581a..57924909 100644 --- a/src/Orb/Models/Items/ItemProperties/ExternalConnection.cs +++ b/src/Orb/Models/Items/ItemProperties/ExternalConnection.cs @@ -1,40 +1,32 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ExternalConnectionProperties = Orb.Models.Items.ItemProperties.ExternalConnectionProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Items.ItemProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ExternalConnection : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ExternalConnection : ModelBase, IFromRaw { public required ExternalConnectionProperties::ExternalConnectionName ExternalConnectionName { get { - if ( - !this.Properties.TryGetValue( - "external_connection_name", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_connection_name", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_connection_name", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("external_connection_name"); + ) ?? throw new ArgumentNullException("external_connection_name"); } set { - this.Properties["external_connection_name"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["external_connection_name"] = JsonSerializer.SerializeToElement(value); } } @@ -42,19 +34,16 @@ public required string ExternalEntityID { get { - if (!this.Properties.TryGetValue("external_entity_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_entity_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_entity_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("external_entity_id"); - } - set - { - this.Properties["external_entity_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("external_entity_id"); } + set { this.Properties["external_entity_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -66,16 +55,14 @@ public override void Validate() public ExternalConnection() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ExternalConnection(Generic::Dictionary properties) + [SetsRequiredMembers] + ExternalConnection(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ExternalConnection FromRawUnchecked( - Generic::Dictionary properties - ) + public static ExternalConnection FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Items/ItemProperties/ExternalConnectionProperties/ExternalConnectionName.cs b/src/Orb/Models/Items/ItemProperties/ExternalConnectionProperties/ExternalConnectionName.cs index 876a7346..4433e3ed 100644 --- a/src/Orb/Models/Items/ItemProperties/ExternalConnectionProperties/ExternalConnectionName.cs +++ b/src/Orb/Models/Items/ItemProperties/ExternalConnectionProperties/ExternalConnectionName.cs @@ -1,12 +1,11 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Items.ItemProperties.ExternalConnectionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] +[JsonConverter(typeof(EnumConverter))] public sealed record class ExternalConnectionName(string value) - : Orb::IEnum + : IEnum { public static readonly ExternalConnectionName Stripe = new("stripe"); @@ -45,7 +44,7 @@ public Value Known() => "taxjar" => Value.Taxjar, "avalara" => Value.Avalara, "anrok" => Value.Anrok, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Items/ItemUpdateParams.cs b/src/Orb/Models/Items/ItemUpdateParams.cs index f9c81690..a17d71fc 100644 --- a/src/Orb/Models/Items/ItemUpdateParams.cs +++ b/src/Orb/Models/Items/ItemUpdateParams.cs @@ -1,43 +1,35 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using ItemUpdateParamsProperties = Orb.Models.Items.ItemUpdateParamsProperties; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; namespace Orb.Models.Items; /// /// This endpoint can be used to update properties on the Item. /// -public sealed record class ItemUpdateParams : Orb::ParamsBase +public sealed record class ItemUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ItemID; - public Generic::List? ExternalConnections + public List? ExternalConnections { get { - if ( - !this.BodyProperties.TryGetValue( - "external_connections", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_connections", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["external_connections"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_connections"] = JsonSerializer.SerializeToElement(value); } } @@ -46,33 +38,33 @@ public sealed record class ItemUpdateParams : Orb::ParamsBase /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } public string? Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/items/{0}", this.ItemID) ) { @@ -80,21 +72,21 @@ public string? Name }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnection.cs b/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnection.cs index 9ad7af51..03c7b33b 100644 --- a/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnection.cs +++ b/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnection.cs @@ -1,40 +1,32 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ExternalConnectionProperties = Orb.Models.Items.ItemUpdateParamsProperties.ExternalConnectionProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Items.ItemUpdateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ExternalConnection : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ExternalConnection : ModelBase, IFromRaw { public required ExternalConnectionProperties::ExternalConnectionName ExternalConnectionName { get { - if ( - !this.Properties.TryGetValue( - "external_connection_name", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_connection_name", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_connection_name", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("external_connection_name"); + ) ?? throw new ArgumentNullException("external_connection_name"); } set { - this.Properties["external_connection_name"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["external_connection_name"] = JsonSerializer.SerializeToElement(value); } } @@ -42,19 +34,16 @@ public required string ExternalEntityID { get { - if (!this.Properties.TryGetValue("external_entity_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_entity_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_entity_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("external_entity_id"); - } - set - { - this.Properties["external_entity_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("external_entity_id"); } + set { this.Properties["external_entity_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -66,16 +55,14 @@ public override void Validate() public ExternalConnection() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ExternalConnection(Generic::Dictionary properties) + [SetsRequiredMembers] + ExternalConnection(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ExternalConnection FromRawUnchecked( - Generic::Dictionary properties - ) + public static ExternalConnection FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnectionProperties/ExternalConnectionName.cs b/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnectionProperties/ExternalConnectionName.cs index 6f76a491..9923bbd9 100644 --- a/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnectionProperties/ExternalConnectionName.cs +++ b/src/Orb/Models/Items/ItemUpdateParamsProperties/ExternalConnectionProperties/ExternalConnectionName.cs @@ -1,12 +1,11 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Items.ItemUpdateParamsProperties.ExternalConnectionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] +[JsonConverter(typeof(EnumConverter))] public sealed record class ExternalConnectionName(string value) - : Orb::IEnum + : IEnum { public static readonly ExternalConnectionName Stripe = new("stripe"); @@ -45,7 +44,7 @@ public Value Known() => "taxjar" => Value.Taxjar, "avalara" => Value.Avalara, "anrok" => Value.Anrok, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/MatrixConfig.cs b/src/Orb/Models/MatrixConfig.cs index e3d22ae3..8a2bf782 100644 --- a/src/Orb/Models/MatrixConfig.cs +++ b/src/Orb/Models/MatrixConfig.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MatrixConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MatrixConfig : ModelBase, IFromRaw { /// /// Default per unit rate for any usage not bucketed into a specified matrix_value @@ -17,57 +16,54 @@ public required string DefaultUnitAmount { get { - if (!this.Properties.TryGetValue("default_unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("default_unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "default_unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("default_unit_amount"); } - set - { - this.Properties["default_unit_amount"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["default_unit_amount"] = JsonSerializer.SerializeToElement(value); } } /// /// One or two event property values to evaluate matrix groups by /// - public required Generic::List Dimensions + public required List Dimensions { get { - if (!this.Properties.TryGetValue("dimensions", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("dimensions", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimensions", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("dimensions"); } - set { this.Properties["dimensions"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["dimensions"] = JsonSerializer.SerializeToElement(value); } } /// /// Matrix values for specified matrix grouping keys /// - public required Generic::List MatrixValues + public required List MatrixValues { get { - if (!this.Properties.TryGetValue("matrix_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("matrix_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "matrix_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("matrix_values"); } - set { this.Properties["matrix_values"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_values"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -86,16 +82,14 @@ public override void Validate() public MatrixConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MatrixConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + MatrixConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MatrixConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static MatrixConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/MatrixSubLineItem.cs b/src/Orb/Models/MatrixSubLineItem.cs index c78a097d..4c702ae1 100644 --- a/src/Orb/Models/MatrixSubLineItem.cs +++ b/src/Orb/Models/MatrixSubLineItem.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MatrixSubLineItemProperties = Orb.Models.MatrixSubLineItemProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MatrixSubLineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MatrixSubLineItem : ModelBase, IFromRaw { /// /// The total amount for this sub line item. @@ -18,88 +17,88 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required SubLineItemGrouping? Grouping { get { - if (!this.Properties.TryGetValue("grouping", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouping", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["grouping"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping"] = JsonSerializer.SerializeToElement(value); } } public required SubLineItemMatrixConfig MatrixConfig { get { - if (!this.Properties.TryGetValue("matrix_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("matrix_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "matrix_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_config"); } - set { this.Properties["matrix_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_config"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public required MatrixSubLineItemProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -115,16 +114,14 @@ public override void Validate() public MatrixSubLineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MatrixSubLineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + MatrixSubLineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MatrixSubLineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static MatrixSubLineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/MatrixSubLineItemProperties/Type.cs b/src/Orb/Models/MatrixSubLineItemProperties/Type.cs index 11f011e4..99c0d8ac 100644 --- a/src/Orb/Models/MatrixSubLineItemProperties/Type.cs +++ b/src/Orb/Models/MatrixSubLineItemProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.MatrixSubLineItemProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Matrix = new("matrix"); diff --git a/src/Orb/Models/MatrixValue.cs b/src/Orb/Models/MatrixValue.cs index c2e68a4d..dfa75dbc 100644 --- a/src/Orb/Models/MatrixValue.cs +++ b/src/Orb/Models/MatrixValue.cs @@ -1,37 +1,33 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MatrixValue : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MatrixValue : ModelBase, IFromRaw { /// /// One or two matrix keys to filter usage to this Matrix value by. For example, /// ["region", "tier"] could be used to filter cloud usage by a cloud region and /// an instance tier. /// - public required Generic::List DimensionValues + public required List DimensionValues { get { - if (!this.Properties.TryGetValue("dimension_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("dimension_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimension_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("dimension_values"); } - set - { - this.Properties["dimension_values"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["dimension_values"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,16 +37,16 @@ public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -65,16 +61,14 @@ public override void Validate() public MatrixValue() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MatrixValue(Generic::Dictionary properties) + [SetsRequiredMembers] + MatrixValue(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MatrixValue FromRawUnchecked( - Generic::Dictionary properties - ) + public static MatrixValue FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/MatrixWithAllocationConfig.cs b/src/Orb/Models/MatrixWithAllocationConfig.cs index 7ac76c72..ddf3ae7f 100644 --- a/src/Orb/Models/MatrixWithAllocationConfig.cs +++ b/src/Orb/Models/MatrixWithAllocationConfig.cs @@ -1,16 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class MatrixWithAllocationConfig - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// Allocation to be used to calculate the price @@ -19,15 +18,15 @@ public required double Allocation { get { - if (!this.Properties.TryGetValue("allocation", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["allocation"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["allocation"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,57 +36,54 @@ public required string DefaultUnitAmount { get { - if (!this.Properties.TryGetValue("default_unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("default_unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "default_unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("default_unit_amount"); } - set - { - this.Properties["default_unit_amount"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["default_unit_amount"] = JsonSerializer.SerializeToElement(value); } } /// /// One or two event property values to evaluate matrix groups by /// - public required Generic::List Dimensions + public required List Dimensions { get { - if (!this.Properties.TryGetValue("dimensions", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("dimensions", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimensions", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("dimensions"); } - set { this.Properties["dimensions"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["dimensions"] = JsonSerializer.SerializeToElement(value); } } /// /// Matrix values for specified matrix grouping keys /// - public required Generic::List MatrixValues + public required List MatrixValues { get { - if (!this.Properties.TryGetValue("matrix_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("matrix_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "matrix_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("matrix_values"); } - set { this.Properties["matrix_values"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_values"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -107,15 +103,15 @@ public override void Validate() public MatrixWithAllocationConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MatrixWithAllocationConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + MatrixWithAllocationConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MatrixWithAllocationConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Maximum.cs b/src/Orb/Models/Maximum.cs index d2b2d971..01972fa6 100644 --- a/src/Orb/Models/Maximum.cs +++ b/src/Orb/Models/Maximum.cs @@ -1,57 +1,51 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Maximum : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Maximum : ModelBase, IFromRaw { /// /// List of price_ids that this maximum amount applies to. For plan/plan phase maximums, /// this can be a subset of prices. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this maximum to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,16 +55,16 @@ public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("maximum_amount"); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -89,16 +83,14 @@ public override void Validate() public Maximum() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Maximum(Generic::Dictionary properties) + [SetsRequiredMembers] + Maximum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Maximum FromRawUnchecked( - Generic::Dictionary properties - ) + public static Maximum FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/MaximumInterval.cs b/src/Orb/Models/MaximumInterval.cs index 4739866c..3f01d3b1 100644 --- a/src/Orb/Models/MaximumInterval.cs +++ b/src/Orb/Models/MaximumInterval.cs @@ -1,26 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MaximumInterval : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MaximumInterval : ModelBase, IFromRaw { /// /// The price interval ids that this maximum interval applies to. /// - public required Generic::List AppliesToPriceIntervalIDs + public required List AppliesToPriceIntervalIDs { get { if ( !this.Properties.TryGetValue( "applies_to_price_interval_ids", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -28,13 +27,14 @@ public sealed record class MaximumInterval : Orb::ModelBase, Orb::IFromRaw>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_interval_ids"); } set { - this.Properties["applies_to_price_interval_ids"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -45,34 +45,34 @@ public sealed record class MaximumInterval : Orb::ModelBase, Orb::IFromRaw(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices this maximum interval applies to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,16 +83,16 @@ public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("maximum_amount"); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,15 +102,15 @@ public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -131,16 +131,14 @@ public override void Validate() public MaximumInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MaximumInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + MaximumInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MaximumInterval FromRawUnchecked( - Generic::Dictionary properties - ) + public static MaximumInterval FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Metrics/BillableMetric.cs b/src/Orb/Models/Metrics/BillableMetric.cs index b6070062..a81fc5ed 100644 --- a/src/Orb/Models/Metrics/BillableMetric.cs +++ b/src/Orb/Models/Metrics/BillableMetric.cs @@ -1,11 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BillableMetricProperties = Orb.Models.Metrics.BillableMetricProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; using Items = Orb.Models.Items; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Metrics; @@ -14,35 +13,32 @@ namespace Orb.Models.Metrics; /// are defined by the query that transforms raw usage events into meaningful values /// for your customers. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BillableMetric : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BillableMetric : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "description", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("description", out JsonElement element)) + throw new ArgumentOutOfRangeException("description", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,13 +50,13 @@ public required string? Description { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } /// @@ -69,49 +65,43 @@ public required string? Description /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); + + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required BillableMetricProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("status"); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -130,16 +120,14 @@ public override void Validate() public BillableMetric() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BillableMetric(Generic::Dictionary properties) + [SetsRequiredMembers] + BillableMetric(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BillableMetric FromRawUnchecked( - Generic::Dictionary properties - ) + public static BillableMetric FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Metrics/BillableMetricProperties/Status.cs b/src/Orb/Models/Metrics/BillableMetricProperties/Status.cs index 6ef41337..d36e915e 100644 --- a/src/Orb/Models/Metrics/BillableMetricProperties/Status.cs +++ b/src/Orb/Models/Metrics/BillableMetricProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Metrics.BillableMetricProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -28,7 +27,7 @@ public Value Known() => "active" => Value.Active, "draft" => Value.Draft, "archived" => Value.Archived, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Metrics/MetricCreateParams.cs b/src/Orb/Models/Metrics/MetricCreateParams.cs index 421cfd85..bec2d1ae 100644 --- a/src/Orb/Models/Metrics/MetricCreateParams.cs +++ b/src/Orb/Models/Metrics/MetricCreateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Metrics; @@ -12,9 +11,9 @@ namespace Orb.Models.Metrics; /// string. See [SQL support](/extensibility/advanced-metrics#sql-support) for a /// description of constructing SQL queries with examples. /// -public sealed record class MetricCreateParams : Orb::ParamsBase +public sealed record class MetricCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// A description of the metric. @@ -23,15 +22,12 @@ public required string? Description { get { - if (!this.BodyProperties.TryGetValue("description", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "description", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("description", out JsonElement element)) + throw new ArgumentOutOfRangeException("description", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,16 +37,13 @@ public required string ItemID { get { - if (!this.BodyProperties.TryGetValue("item_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "item_id", - "Missing required argument" - ); + if (!this.BodyProperties.TryGetValue("item_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("item_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item_id"); } - set { this.BodyProperties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["item_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -60,13 +53,13 @@ public required string Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,13 +69,13 @@ public required string Sql { get { - if (!this.BodyProperties.TryGetValue("sql", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("sql", "Missing required argument"); + if (!this.BodyProperties.TryGetValue("sql", out JsonElement element)) + throw new ArgumentOutOfRangeException("sql", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("sql"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("sql"); } - set { this.BodyProperties["sql"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["sql"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,41 +83,41 @@ public required string Sql /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/metrics") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/metrics") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Metrics/MetricFetchParams.cs b/src/Orb/Models/Metrics/MetricFetchParams.cs index 007db620..5973dabd 100644 --- a/src/Orb/Models/Metrics/MetricFetchParams.cs +++ b/src/Orb/Models/Metrics/MetricFetchParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Metrics; @@ -8,13 +7,13 @@ namespace Orb.Models.Metrics; /// This endpoint is used to list [metrics](/core-concepts#metric). It returns information /// about the metrics including its name, description, and item. /// -public sealed record class MetricFetchParams : Orb::ParamsBase +public sealed record class MetricFetchParams : ParamsBase { public required string MetricID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/metrics/{0}", this.MetricID) ) { @@ -22,12 +21,12 @@ public sealed record class MetricFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Metrics/MetricListPageResponse.cs b/src/Orb/Models/Metrics/MetricListPageResponse.cs index 359d34f1..76be9bda 100644 --- a/src/Orb/Models/Metrics/MetricListPageResponse.cs +++ b/src/Orb/Models/Metrics/MetricListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Metrics; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MetricListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MetricListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,15 +51,15 @@ public override void Validate() public MetricListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MetricListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + MetricListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MetricListPageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Metrics/MetricListParams.cs b/src/Orb/Models/Metrics/MetricListParams.cs index 020ff2d5..ecabf59f 100644 --- a/src/Orb/Models/Metrics/MetricListParams.cs +++ b/src/Orb/Models/Metrics/MetricListParams.cs @@ -1,7 +1,6 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; +using System.Text.Json; namespace Orb.Models.Metrics; @@ -10,70 +9,54 @@ namespace Orb.Models.Metrics; /// a metric identifier. It returns information about the metrics including its name, /// description, and item. /// -public sealed record class MetricListParams : Orb::ParamsBase +public sealed record class MetricListParams : ParamsBase { - public System::DateTime? CreatedAtGt + public DateTime? CreatedAtGt { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtGte + public DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtLt + public DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtLte + public DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -84,12 +67,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -99,28 +82,28 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/metrics") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/metrics") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Metrics/MetricUpdateParams.cs b/src/Orb/Models/Metrics/MetricUpdateParams.cs index 1eb802fa..03225aba 100644 --- a/src/Orb/Models/Metrics/MetricUpdateParams.cs +++ b/src/Orb/Models/Metrics/MetricUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Metrics; @@ -11,9 +10,9 @@ namespace Orb.Models.Metrics; /// This endpoint allows you to update the `metadata` property on a metric. If you /// pass `null` for the metadata value, it will clear any existing metadata for that invoice. /// -public sealed record class MetricUpdateParams : Orb::ParamsBase +public sealed record class MetricUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string MetricID; @@ -22,21 +21,21 @@ public sealed record class MetricUpdateParams : Orb::ParamsBase /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/metrics/{0}", this.MetricID) ) { @@ -44,21 +43,21 @@ public sealed record class MetricUpdateParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Minimum.cs b/src/Orb/Models/Minimum.cs index b1b44cd2..3aa3feee 100644 --- a/src/Orb/Models/Minimum.cs +++ b/src/Orb/Models/Minimum.cs @@ -1,57 +1,51 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Minimum : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Minimum : ModelBase, IFromRaw { /// /// List of price_ids that this minimum amount applies to. For plan/plan phase minimums, /// this can be a subset of prices. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this minimum to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,16 +55,16 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("minimum_amount"); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -89,16 +83,14 @@ public override void Validate() public Minimum() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Minimum(Generic::Dictionary properties) + [SetsRequiredMembers] + Minimum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Minimum FromRawUnchecked( - Generic::Dictionary properties - ) + public static Minimum FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/MinimumInterval.cs b/src/Orb/Models/MinimumInterval.cs index b243698b..5aeb80c0 100644 --- a/src/Orb/Models/MinimumInterval.cs +++ b/src/Orb/Models/MinimumInterval.cs @@ -1,26 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MinimumInterval : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MinimumInterval : ModelBase, IFromRaw { /// /// The price interval ids that this minimum interval applies to. /// - public required Generic::List AppliesToPriceIntervalIDs + public required List AppliesToPriceIntervalIDs { get { if ( !this.Properties.TryGetValue( "applies_to_price_interval_ids", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -28,13 +27,14 @@ public sealed record class MinimumInterval : Orb::ModelBase, Orb::IFromRaw>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_interval_ids"); } set { - this.Properties["applies_to_price_interval_ids"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -45,34 +45,34 @@ public sealed record class MinimumInterval : Orb::ModelBase, Orb::IFromRaw(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices this minimum interval applies to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,16 +83,16 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("minimum_amount"); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,15 +102,15 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -131,16 +131,14 @@ public override void Validate() public MinimumInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MinimumInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + MinimumInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MinimumInterval FromRawUnchecked( - Generic::Dictionary properties - ) + public static MinimumInterval FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/MonetaryAmountDiscountAdjustment.cs b/src/Orb/Models/MonetaryAmountDiscountAdjustment.cs index cbac484a..28b2d851 100644 --- a/src/Orb/Models/MonetaryAmountDiscountAdjustment.cs +++ b/src/Orb/Models/MonetaryAmountDiscountAdjustment.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MonetaryAmountDiscountAdjustmentProperties = Orb.Models.MonetaryAmountDiscountAdjustmentProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class MonetaryAmountDiscountAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required MonetaryAmountDiscountAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,16 +49,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -70,59 +69,54 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_discount"); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -133,18 +127,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,15 +145,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -173,24 +164,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -216,15 +200,15 @@ public override void Validate() public MonetaryAmountDiscountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MonetaryAmountDiscountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + MonetaryAmountDiscountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MonetaryAmountDiscountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/MonetaryAmountDiscountAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/MonetaryAmountDiscountAdjustmentProperties/AdjustmentType.cs index d4a7ae37..154a3aba 100644 --- a/src/Orb/Models/MonetaryAmountDiscountAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/MonetaryAmountDiscountAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.MonetaryAmountDiscountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType AmountDiscount = new("amount_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "amount_discount" => Value.AmountDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/MonetaryMaximumAdjustment.cs b/src/Orb/Models/MonetaryMaximumAdjustment.cs index 89df5e0d..ebcce45b 100644 --- a/src/Orb/Models/MonetaryMaximumAdjustment.cs +++ b/src/Orb/Models/MonetaryMaximumAdjustment.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MonetaryMaximumAdjustmentProperties = Orb.Models.MonetaryMaximumAdjustmentProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class MonetaryMaximumAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required MonetaryMaximumAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,59 +49,54 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -113,18 +107,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,16 +126,16 @@ public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("maximum_amount"); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,15 +145,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -173,24 +164,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -216,15 +200,15 @@ public override void Validate() public MonetaryMaximumAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MonetaryMaximumAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + MonetaryMaximumAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MonetaryMaximumAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/MonetaryMaximumAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/MonetaryMaximumAdjustmentProperties/AdjustmentType.cs index 91e6bc20..bfd062d4 100644 --- a/src/Orb/Models/MonetaryMaximumAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/MonetaryMaximumAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.MonetaryMaximumAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType Maximum = new("maximum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "maximum" => Value.Maximum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/MonetaryMinimumAdjustment.cs b/src/Orb/Models/MonetaryMinimumAdjustment.cs index 53fe1944..2eb06a44 100644 --- a/src/Orb/Models/MonetaryMinimumAdjustment.cs +++ b/src/Orb/Models/MonetaryMinimumAdjustment.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MonetaryMinimumAdjustmentProperties = Orb.Models.MonetaryMinimumAdjustmentProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class MonetaryMinimumAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required MonetaryMinimumAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,59 +49,54 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -113,18 +107,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -134,16 +125,16 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,16 +145,16 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("minimum_amount"); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -173,15 +164,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -192,24 +183,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -236,15 +220,15 @@ public override void Validate() public MonetaryMinimumAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MonetaryMinimumAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + MonetaryMinimumAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MonetaryMinimumAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/MonetaryMinimumAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/MonetaryMinimumAdjustmentProperties/AdjustmentType.cs index 33399b31..276b6d0d 100644 --- a/src/Orb/Models/MonetaryMinimumAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/MonetaryMinimumAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.MonetaryMinimumAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType Minimum = new("minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "minimum" => Value.Minimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/MonetaryPercentageDiscountAdjustment.cs b/src/Orb/Models/MonetaryPercentageDiscountAdjustment.cs index 6c762402..94a82090 100644 --- a/src/Orb/Models/MonetaryPercentageDiscountAdjustment.cs +++ b/src/Orb/Models/MonetaryPercentageDiscountAdjustment.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MonetaryPercentageDiscountAdjustmentProperties = Orb.Models.MonetaryPercentageDiscountAdjustmentProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class MonetaryPercentageDiscountAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required MonetaryPercentageDiscountAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,59 +49,54 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -113,18 +107,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,18 +126,15 @@ public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +144,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,24 +163,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -218,15 +199,15 @@ public override void Validate() public MonetaryPercentageDiscountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MonetaryPercentageDiscountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + MonetaryPercentageDiscountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MonetaryPercentageDiscountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/MonetaryPercentageDiscountAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/MonetaryPercentageDiscountAdjustmentProperties/AdjustmentType.cs index a78fc890..4966c182 100644 --- a/src/Orb/Models/MonetaryPercentageDiscountAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/MonetaryPercentageDiscountAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.MonetaryPercentageDiscountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType PercentageDiscount = new("percentage_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage_discount" => Value.PercentageDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/MonetaryUsageDiscountAdjustment.cs b/src/Orb/Models/MonetaryUsageDiscountAdjustment.cs index 13d8cbf1..554699af 100644 --- a/src/Orb/Models/MonetaryUsageDiscountAdjustment.cs +++ b/src/Orb/Models/MonetaryUsageDiscountAdjustment.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MonetaryUsageDiscountAdjustmentProperties = Orb.Models.MonetaryUsageDiscountAdjustmentProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class MonetaryUsageDiscountAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required MonetaryUsageDiscountAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,59 +49,54 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -113,18 +107,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -134,15 +125,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -153,24 +144,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -182,15 +166,15 @@ public required double UsageDiscount { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -215,15 +199,15 @@ public override void Validate() public MonetaryUsageDiscountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MonetaryUsageDiscountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + MonetaryUsageDiscountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static MonetaryUsageDiscountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/MonetaryUsageDiscountAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/MonetaryUsageDiscountAdjustmentProperties/AdjustmentType.cs index 2c06d25b..098d679f 100644 --- a/src/Orb/Models/MonetaryUsageDiscountAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/MonetaryUsageDiscountAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.MonetaryUsageDiscountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType UsageDiscount = new("usage_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "usage_discount" => Value.UsageDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewAllocationPrice.cs b/src/Orb/Models/NewAllocationPrice.cs index c5188cdc..03f58a36 100644 --- a/src/Orb/Models/NewAllocationPrice.cs +++ b/src/Orb/Models/NewAllocationPrice.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewAllocationPriceProperties = Orb.Models.NewAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewAllocationPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewAllocationPrice : ModelBase, IFromRaw { /// /// An amount of the currency to allocate to the customer at the specified cadence. @@ -18,16 +17,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,16 +36,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,16 +56,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,15 +75,12 @@ public CustomExpiration? CustomExpiration { get { - if (!this.Properties.TryGetValue("custom_expiration", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("custom_expiration", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["custom_expiration"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["custom_expiration"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,21 +91,14 @@ public bool? ExpiresAtEndOfCadence { get { - if ( - !this.Properties.TryGetValue( - "expires_at_end_of_cadence", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("expires_at_end_of_cadence", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["expires_at_end_of_cadence"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["expires_at_end_of_cadence"] = JsonSerializer.SerializeToElement(value); } } @@ -125,16 +114,14 @@ public override void Validate() public NewAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewAllocationPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewAllocationPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewAllocationPriceProperties/Cadence.cs index 9da997d4..30d92da0 100644 --- a/src/Orb/Models/NewAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewAllocationPriceProperties; /// /// The cadence at which to allocate the amount to the customer. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -39,7 +38,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewAmountDiscount.cs b/src/Orb/Models/NewAmountDiscount.cs index 5aaa7c64..fb53dec3 100644 --- a/src/Orb/Models/NewAmountDiscount.cs +++ b/src/Orb/Models/NewAmountDiscount.cs @@ -1,47 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewAmountDiscountProperties = Orb.Models.NewAmountDiscountProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewAmountDiscount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewAmountDiscount : ModelBase, IFromRaw { public required NewAmountDiscountProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("adjustment_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_discount"); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -51,52 +49,42 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("applies_to_all", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_all", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applies_to_all"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applies_to_all"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of item IDs to which this adjustment applies. /// - public Generic::List? AppliesToItemIDs + public List? AppliesToItemIDs { get { - if (!this.Properties.TryGetValue("applies_to_item_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_item_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_item_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_item_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of price IDs to which this adjustment applies. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,27 +94,27 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of filters that determine which prices this adjustment will apply to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +125,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,14 +140,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -190,16 +173,14 @@ public override void Validate() public NewAmountDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewAmountDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + NewAmountDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewAmountDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewAmountDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewAmountDiscountProperties/AdjustmentType.cs b/src/Orb/Models/NewAmountDiscountProperties/AdjustmentType.cs index aedca4c8..c60a9a5d 100644 --- a/src/Orb/Models/NewAmountDiscountProperties/AdjustmentType.cs +++ b/src/Orb/Models/NewAmountDiscountProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewAmountDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType AmountDiscount = new("amount_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "amount_discount" => Value.AmountDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewAmountDiscountProperties/AppliesToAll.cs b/src/Orb/Models/NewAmountDiscountProperties/AppliesToAll.cs index 427370a4..585d6875 100644 --- a/src/Orb/Models/NewAmountDiscountProperties/AppliesToAll.cs +++ b/src/Orb/Models/NewAmountDiscountProperties/AppliesToAll.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewAmountDiscountProperties; /// /// If set, the adjustment will apply to every price on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AppliesToAll(bool value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AppliesToAll(bool value) : IEnum { public static readonly AppliesToAll True = new(true); @@ -23,7 +22,7 @@ public Value Known() => _value switch { true => Value.True, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public bool Raw() diff --git a/src/Orb/Models/NewAmountDiscountProperties/PriceType.cs b/src/Orb/Models/NewAmountDiscountProperties/PriceType.cs index b042d86c..a3acdb9b 100644 --- a/src/Orb/Models/NewAmountDiscountProperties/PriceType.cs +++ b/src/Orb/Models/NewAmountDiscountProperties/PriceType.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewAmountDiscountProperties; /// /// If set, only prices of the specified type will have the adjustment applied. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType Usage = new("usage"); @@ -39,7 +38,7 @@ public Value Known() => "fixed_in_arrears" => Value.FixedInArrears, "fixed" => Value.Fixed, "in_arrears" => Value.InArrears, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewBillingCycleConfiguration.cs b/src/Orb/Models/NewBillingCycleConfiguration.cs index 0696f624..6def1f69 100644 --- a/src/Orb/Models/NewBillingCycleConfiguration.cs +++ b/src/Orb/Models/NewBillingCycleConfiguration.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewBillingCycleConfigurationProperties = Orb.Models.NewBillingCycleConfigurationProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewBillingCycleConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The duration of the billing period. @@ -20,15 +19,15 @@ public required long Duration { get { - if (!this.Properties.TryGetValue("duration", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "duration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,17 +37,17 @@ public required long Duration { get { - if (!this.Properties.TryGetValue("duration_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "duration_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("duration_unit"); } - set { this.Properties["duration_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -60,15 +59,15 @@ public override void Validate() public NewBillingCycleConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewBillingCycleConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewBillingCycleConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewBillingCycleConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewBillingCycleConfigurationProperties/DurationUnit.cs b/src/Orb/Models/NewBillingCycleConfigurationProperties/DurationUnit.cs index 4d1a37f5..5f0adaa7 100644 --- a/src/Orb/Models/NewBillingCycleConfigurationProperties/DurationUnit.cs +++ b/src/Orb/Models/NewBillingCycleConfigurationProperties/DurationUnit.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewBillingCycleConfigurationProperties; /// /// The unit of billing period duration. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DurationUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DurationUnit(string value) : IEnum { public static readonly DurationUnit Day = new("day"); @@ -27,7 +26,7 @@ public Value Known() => { "day" => Value.Day, "month" => Value.Month, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewDimensionalPriceConfiguration.cs b/src/Orb/Models/NewDimensionalPriceConfiguration.cs index 0701b67a..feae9dc3 100644 --- a/src/Orb/Models/NewDimensionalPriceConfiguration.cs +++ b/src/Orb/Models/NewDimensionalPriceConfiguration.cs @@ -1,37 +1,33 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewDimensionalPriceConfiguration - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The list of dimension values matching (in order) the dimensions of the price group /// - public required Generic::List DimensionValues + public required List DimensionValues { get { - if (!this.Properties.TryGetValue("dimension_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("dimension_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimension_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("dimension_values"); } - set - { - this.Properties["dimension_values"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["dimension_values"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,19 +37,14 @@ public string? DimensionalPriceGroupID { get { - if ( - !this.Properties.TryGetValue( - "dimensional_price_group_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("dimensional_price_group_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_group_id"] = Json::JsonSerializer.SerializeToElement( + this.Properties["dimensional_price_group_id"] = JsonSerializer.SerializeToElement( value ); } @@ -69,17 +60,17 @@ public string? ExternalDimensionalPriceGroupID if ( !this.Properties.TryGetValue( "external_dimensional_price_group_id", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.Properties["external_dimensional_price_group_id"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -96,15 +87,15 @@ public override void Validate() public NewDimensionalPriceConfiguration() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewDimensionalPriceConfiguration(Generic::Dictionary properties) + [SetsRequiredMembers] + NewDimensionalPriceConfiguration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewDimensionalPriceConfiguration FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingBPSPrice.cs b/src/Orb/Models/NewFloatingBPSPrice.cs index 7dbaa67a..f89368a2 100644 --- a/src/Orb/Models/NewFloatingBPSPrice.cs +++ b/src/Orb/Models/NewFloatingBPSPrice.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingBPSPriceProperties = Orb.Models.NewFloatingBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingBPSPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingBPSPrice : ModelBase, IFromRaw { public required BPSConfig BPSConfig { get { - if (!this.Properties.TryGetValue("bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bps_config"); } - set { this.Properties["bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,16 +33,16 @@ public required BPSConfig BPSConfig { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,16 +52,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,33 +71,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -108,13 +106,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -143,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -162,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -185,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -200,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -230,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -251,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -269,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -289,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -313,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -332,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -374,16 +346,14 @@ public override void Validate() public NewFloatingBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewFloatingBPSPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewFloatingBPSPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewFloatingBPSPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingBPSPriceProperties/Cadence.cs index b1805e96..19ef41f0 100644 --- a/src/Orb/Models/NewFloatingBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfig.cs index 50ce01aa..f68d1918 100644 --- a/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfigVariants/All.cs index edd6c637..7d5ab9c2 100644 --- a/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingBPSPriceProperties = Orb.Models.NewFloatingBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingBPSPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingBPSPriceProperties/ModelType.cs index 33917b43..ac2db1d1 100644 --- a/src/Orb/Models/NewFloatingBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BPS = new("bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bps" => Value.BPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBulkBPSPrice.cs b/src/Orb/Models/NewFloatingBulkBPSPrice.cs index c2d3dddf..ad76d6bf 100644 --- a/src/Orb/Models/NewFloatingBulkBPSPrice.cs +++ b/src/Orb/Models/NewFloatingBulkBPSPrice.cs @@ -1,32 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingBulkBPSPriceProperties = Orb.Models.NewFloatingBulkBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingBulkBPSPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingBulkBPSPrice : ModelBase, IFromRaw { public required BulkBPSConfig BulkBPSConfig { get { - if (!this.Properties.TryGetValue("bulk_bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bulk_bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bulk_bps_config"); } - set { this.Properties["bulk_bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,17 +33,16 @@ public required BulkBPSConfig BulkBPSConfig { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -56,16 +52,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -75,33 +71,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingBulkBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -111,13 +106,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -165,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -233,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -377,15 +346,15 @@ public override void Validate() public NewFloatingBulkBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingBulkBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingBulkBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingBulkBPSPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/Cadence.cs index 2f1378b9..bbd73ed6 100644 --- a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfig.cs index e90ccfdc..a2d2aee1 100644 --- a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingBulkBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs index bbed0412..a2258a40 100644 --- a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingBulkBPSPriceProperties = Orb.Models.NewFloatingBulkBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingBulkBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingBulkBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ModelType.cs index db96a767..ff720ade 100644 --- a/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingBulkBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BulkBPS = new("bulk_bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk_bps" => Value.BulkBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBulkPrice.cs b/src/Orb/Models/NewFloatingBulkPrice.cs index 257c5507..a8308b2f 100644 --- a/src/Orb/Models/NewFloatingBulkPrice.cs +++ b/src/Orb/Models/NewFloatingBulkPrice.cs @@ -1,32 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingBulkPriceProperties = Orb.Models.NewFloatingBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingBulkPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingBulkPrice : ModelBase, IFromRaw { public required BulkConfig BulkConfig { get { - if (!this.Properties.TryGetValue("bulk_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bulk_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bulk_config"); } - set { this.Properties["bulk_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,17 +33,16 @@ public required BulkConfig BulkConfig { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -56,16 +52,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -75,33 +71,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingBulkPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -111,13 +106,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -165,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -233,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -377,16 +346,14 @@ public override void Validate() public NewFloatingBulkPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingBulkPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingBulkPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewFloatingBulkPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewFloatingBulkPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewFloatingBulkPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingBulkPriceProperties/Cadence.cs index d164cdde..3bb00ba3 100644 --- a/src/Orb/Models/NewFloatingBulkPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingBulkPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfig.cs index bc69f853..582647a7 100644 --- a/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingBulkPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfigVariants/All.cs index 1767fc3b..78695c2a 100644 --- a/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingBulkPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingBulkPriceProperties = Orb.Models.NewFloatingBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingBulkPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingBulkPriceProperties/ModelType.cs index fe35b777..394f2f63 100644 --- a/src/Orb/Models/NewFloatingBulkPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingBulkPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Bulk = new("bulk"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk" => Value.Bulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBulkWithProrationPrice.cs b/src/Orb/Models/NewFloatingBulkWithProrationPrice.cs index 97f6909c..264a600d 100644 --- a/src/Orb/Models/NewFloatingBulkWithProrationPrice.cs +++ b/src/Orb/Models/NewFloatingBulkWithProrationPrice.cs @@ -1,40 +1,33 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingBulkWithProrationPriceProperties = Orb.Models.NewFloatingBulkWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingBulkWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::Dictionary BulkWithProrationConfig + public required Dictionary BulkWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "bulk_with_proration_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("bulk_with_proration_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("bulk_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("bulk_with_proration_config"); } set { - this.Properties["bulk_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["bulk_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -47,17 +40,17 @@ public sealed record class NewFloatingBulkWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -67,16 +60,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -86,33 +79,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingBulkWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,13 +115,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +131,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,15 +147,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,19 +163,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -199,12 +184,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -214,23 +199,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -244,17 +222,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +244,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +259,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,17 +274,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,17 +293,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +313,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -391,15 +358,15 @@ public override void Validate() public NewFloatingBulkWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingBulkWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingBulkWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingBulkWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/Cadence.cs index ca77f526..e6642894 100644 --- a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfig.cs index 29bb42ef..6060f148 100644 --- a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingBulkWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 5c1ae0a9..e9f6966a 100644 --- a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingBulkWithProrationPriceProperties = Orb.Models.NewFloatingBulkWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingBulkWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingBulkWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ModelType.cs index 6f641c05..a42eff3e 100644 --- a/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingBulkWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingBulkWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BulkWithProration = new("bulk_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk_with_proration" => Value.BulkWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPrice.cs b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPrice.cs index e8286a0c..8bcc0d5a 100644 --- a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPrice.cs +++ b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingCumulativeGroupedBulkPriceProperties = Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingCumulativeGroupedBulkPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,27 +19,27 @@ public sealed record class NewFloatingCumulativeGroupedBulkPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary CumulativeGroupedBulkConfig + public required Dictionary CumulativeGroupedBulkConfig { get { if ( !this.Properties.TryGetValue( "cumulative_grouped_bulk_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -48,14 +47,14 @@ public sealed record class NewFloatingCumulativeGroupedBulkPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); } set { - this.Properties["cumulative_grouped_bulk_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["cumulative_grouped_bulk_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -66,16 +65,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -85,33 +84,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingCumulativeGroupedBulkPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,13 +120,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingCumulativeGroupedBulkPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingCumulativeGroupedBulkPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingCumulativeGroupedBulkPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingCumulativeGroupedBulkPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/Cadence.cs index db47cb76..d4fa0f47 100644 --- a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs index 831bc792..e7993ae2 100644 --- a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs index a561e23c..ab574c28 100644 --- a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingCumulativeGroupedBulkPriceProperties = Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingCumulativeGroupedBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingCumulativeGroupedBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ModelType.cs index de2a5ff8..e6c7e3bc 100644 --- a/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingCumulativeGroupedBulkPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingCumulativeGroupedBulkPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType CumulativeGroupedBulk = new("cumulative_grouped_bulk"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "cumulative_grouped_bulk" => Value.CumulativeGroupedBulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedAllocationPrice.cs b/src/Orb/Models/NewFloatingGroupedAllocationPrice.cs index 2436ead3..cfc0df84 100644 --- a/src/Orb/Models/NewFloatingGroupedAllocationPrice.cs +++ b/src/Orb/Models/NewFloatingGroupedAllocationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingGroupedAllocationPriceProperties = Orb.Models.NewFloatingGroupedAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingGroupedAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingGroupedAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,42 +39,34 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedAllocationConfig + public required Dictionary GroupedAllocationConfig { get { - if ( - !this.Properties.TryGetValue( - "grouped_allocation_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("grouped_allocation_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouped_allocation_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_allocation_config"); } set { - this.Properties["grouped_allocation_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["grouped_allocation_config"] = JsonSerializer.SerializeToElement(value); } } @@ -86,33 +77,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingGroupedAllocationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,13 +113,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +129,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,15 +145,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,19 +161,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -199,12 +182,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -214,23 +197,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -244,17 +220,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +242,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +257,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,17 +272,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,17 +291,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +311,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -391,15 +356,15 @@ public override void Validate() public NewFloatingGroupedAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingGroupedAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingGroupedAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingGroupedAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/Cadence.cs index c2b2e917..b582d9a6 100644 --- a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfig.cs index be94e14d..2cdbf2e2 100644 --- a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingGroupedAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs index 8b45c29d..5c7de49e 100644 --- a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingGroupedAllocationPriceProperties = Orb.Models.NewFloatingGroupedAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingGroupedAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingGroupedAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ModelType.cs index 4f3f876b..ee39f290 100644 --- a/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingGroupedAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedAllocation = new("grouped_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_allocation" => Value.GroupedAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedTieredPackagePrice.cs b/src/Orb/Models/NewFloatingGroupedTieredPackagePrice.cs index fa3347e7..78d61029 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPackagePrice.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPackagePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingGroupedTieredPackagePriceProperties = Orb.Models.NewFloatingGroupedTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingGroupedTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingGroupedTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,26 +39,26 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredPackageConfig + public required Dictionary GroupedTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "grouped_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -67,14 +66,14 @@ public required string Currency "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); } set { - this.Properties["grouped_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["grouped_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -85,33 +84,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingGroupedTieredPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,13 +120,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingGroupedTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingGroupedTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingGroupedTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingGroupedTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/Cadence.cs index 7fbfeb24..c6304782 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfig.cs index 311b7b37..08946992 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingGroupedTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index f3fcb882..1d220f4a 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingGroupedTieredPackagePriceProperties = Orb.Models.NewFloatingGroupedTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingGroupedTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingGroupedTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ModelType.cs index 84dcf62d..040f012d 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedTieredPackage = new("grouped_tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_tiered_package" => Value.GroupedTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedTieredPrice.cs b/src/Orb/Models/NewFloatingGroupedTieredPrice.cs index 5c2071d8..ed87ea36 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPrice.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingGroupedTieredPriceProperties = Orb.Models.NewFloatingGroupedTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingGroupedTieredPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingGroupedTieredPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,40 +39,32 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredConfig + public required Dictionary GroupedTieredConfig { get { - if ( - !this.Properties.TryGetValue("grouped_tiered_config", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("grouped_tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouped_tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_config"); - } - set - { - this.Properties["grouped_tiered_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_tiered_config"); } + set { this.Properties["grouped_tiered_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,33 +74,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingGroupedTieredPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,13 +110,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,15 +126,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,15 +142,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -173,19 +158,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -196,12 +179,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -211,23 +194,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -241,17 +217,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +239,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +254,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +269,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +288,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +308,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -388,15 +353,15 @@ public override void Validate() public NewFloatingGroupedTieredPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingGroupedTieredPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingGroupedTieredPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingGroupedTieredPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/Cadence.cs index 5cf5dd06..96675b07 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfig.cs index fb6fc01a..9b927744 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingGroupedTieredPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs index cb8d59fe..26ad3761 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingGroupedTieredPriceProperties = Orb.Models.NewFloatingGroupedTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingGroupedTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingGroupedTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ModelType.cs index 19cc4976..29d32599 100644 --- a/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingGroupedTieredPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedTieredPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedTiered = new("grouped_tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_tiered" => Value.GroupedTiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPrice.cs b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPrice.cs index 66bf8093..ca9e4557 100644 --- a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPrice.cs +++ b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingGroupedWithMeteredMinimumPriceProperties = Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingGroupedWithMeteredMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewFloatingGroupedWithMeteredMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,26 +39,26 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithMeteredMinimumConfig + public required Dictionary GroupedWithMeteredMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_metered_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -69,14 +66,13 @@ public required string Currency "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); } set { this.Properties["grouped_with_metered_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -87,33 +83,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingGroupedWithMeteredMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -123,13 +119,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,15 +135,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -158,15 +151,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -177,19 +167,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -200,12 +188,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -215,23 +203,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -245,17 +226,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +248,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +263,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,17 +278,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -328,17 +297,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +317,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -392,17 +362,15 @@ public override void Validate() public NewFloatingGroupedWithMeteredMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingGroupedWithMeteredMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewFloatingGroupedWithMeteredMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingGroupedWithMeteredMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/Cadence.cs index a1a5bbb1..c64261d9 100644 --- a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs index 47a97402..9ca9fe8b 100644 --- a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 73c86492..4eaf37b1 100644 --- a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingGroupedWithMeteredMinimumPriceProperties = Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingGroupedWithMeteredMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingGroupedWithMeteredMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ModelType.cs index cd928323..22bc0d8b 100644 --- a/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingGroupedWithMeteredMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithMeteredMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedWithMeteredMinimum = new( "grouped_with_metered_minimum" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "grouped_with_metered_minimum" => Value.GroupedWithMeteredMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPrice.cs b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPrice.cs index 461612c8..65b08765 100644 --- a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPrice.cs +++ b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingGroupedWithProratedMinimumPriceProperties = Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingGroupedWithProratedMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewFloatingGroupedWithProratedMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,26 +39,26 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithProratedMinimumConfig + public required Dictionary GroupedWithProratedMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_prorated_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -69,15 +66,13 @@ public required string Currency "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("grouped_with_prorated_minimum_config"); } set { this.Properties["grouped_with_prorated_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -88,33 +83,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingGroupedWithProratedMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,13 +119,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,15 +135,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,15 +151,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -178,19 +167,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -201,12 +188,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -216,23 +203,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -246,17 +226,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -267,15 +248,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -285,17 +263,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -305,17 +278,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -329,17 +297,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -348,16 +317,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -393,17 +362,15 @@ public override void Validate() public NewFloatingGroupedWithProratedMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingGroupedWithProratedMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewFloatingGroupedWithProratedMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingGroupedWithProratedMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/Cadence.cs index 429f1dea..f7ebca46 100644 --- a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs index 56ad80ec..968dbff8 100644 --- a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 31c14351..e8373e45 100644 --- a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingGroupedWithProratedMinimumPriceProperties = Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingGroupedWithProratedMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingGroupedWithProratedMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ModelType.cs index a5930b6a..70706772 100644 --- a/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingGroupedWithProratedMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingGroupedWithProratedMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedWithProratedMinimum = new( "grouped_with_prorated_minimum" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "grouped_with_prorated_minimum" => Value.GroupedWithProratedMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMatrixPrice.cs b/src/Orb/Models/NewFloatingMatrixPrice.cs index fe852f78..6ea20a9b 100644 --- a/src/Orb/Models/NewFloatingMatrixPrice.cs +++ b/src/Orb/Models/NewFloatingMatrixPrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingMatrixPriceProperties = Orb.Models.NewFloatingMatrixPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingMatrixPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingMatrixPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +17,16 @@ public sealed record class NewFloatingMatrixPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +36,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,49 +55,48 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required MatrixConfig MatrixConfig { get { - if (!this.Properties.TryGetValue("matrix_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("matrix_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "matrix_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_config"); } - set { this.Properties["matrix_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_config"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingMatrixPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -111,13 +106,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -165,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -233,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -377,15 +346,15 @@ public override void Validate() public NewFloatingMatrixPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingMatrixPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingMatrixPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingMatrixPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingMatrixPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingMatrixPriceProperties/Cadence.cs index 6b819d66..c57109d9 100644 --- a/src/Orb/Models/NewFloatingMatrixPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingMatrixPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfig.cs index 0f773837..d343c31f 100644 --- a/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingMatrixPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfigVariants/All.cs index 11a45d69..c211761d 100644 --- a/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingMatrixPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingMatrixPriceProperties = Orb.Models.NewFloatingMatrixPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingMatrixPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingMatrixPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingMatrixPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingMatrixPriceProperties/ModelType.cs index b3eaf331..a7f34659 100644 --- a/src/Orb/Models/NewFloatingMatrixPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingMatrixPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Matrix = new("matrix"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix" => Value.Matrix, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMatrixWithAllocationPrice.cs b/src/Orb/Models/NewFloatingMatrixWithAllocationPrice.cs index 09f4f793..8a012d7d 100644 --- a/src/Orb/Models/NewFloatingMatrixWithAllocationPrice.cs +++ b/src/Orb/Models/NewFloatingMatrixWithAllocationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingMatrixWithAllocationPriceProperties = Orb.Models.NewFloatingMatrixWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingMatrixWithAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingMatrixWithAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,16 +58,16 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required MatrixWithAllocationConfig MatrixWithAllocationConfig @@ -78,7 +77,7 @@ public required MatrixWithAllocationConfig MatrixWithAllocationConfig if ( !this.Properties.TryGetValue( "matrix_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -86,13 +85,14 @@ public required MatrixWithAllocationConfig MatrixWithAllocationConfig "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_with_allocation_config"); } set { - this.Properties["matrix_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -100,17 +100,17 @@ public required MatrixWithAllocationConfig MatrixWithAllocationConfig { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -120,13 +120,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -174,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -197,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -212,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -242,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -263,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -281,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -301,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -325,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -344,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -386,15 +360,15 @@ public override void Validate() public NewFloatingMatrixWithAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingMatrixWithAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingMatrixWithAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingMatrixWithAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/Cadence.cs index 8ea3891f..68b242da 100644 --- a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfig.cs index 8496f1dd..b5537130 100644 --- a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingMatrixWithAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs index 921f1b76..4a46b291 100644 --- a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingMatrixWithAllocationPriceProperties = Orb.Models.NewFloatingMatrixWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingMatrixWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingMatrixWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ModelType.cs index 24e0ce9a..f68d1e40 100644 --- a/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingMatrixWithAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MatrixWithAllocation = new("matrix_with_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix_with_allocation" => Value.MatrixWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePrice.cs b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePrice.cs index 448cd793..df7219c6 100644 --- a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePrice.cs +++ b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingMatrixWithDisplayNamePriceProperties = Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingMatrixWithDisplayNamePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingMatrixWithDisplayNamePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,26 +58,26 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MatrixWithDisplayNameConfig + public required Dictionary MatrixWithDisplayNameConfig { get { if ( !this.Properties.TryGetValue( "matrix_with_display_name_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -86,14 +85,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); } set { - this.Properties["matrix_with_display_name_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_display_name_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -101,17 +100,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,13 +120,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingMatrixWithDisplayNamePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingMatrixWithDisplayNamePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingMatrixWithDisplayNamePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingMatrixWithDisplayNamePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/Cadence.cs index 80e64139..417fd704 100644 --- a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs index f09bb7e7..2483a3ea 100644 --- a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs index 25032694..43554445 100644 --- a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingMatrixWithDisplayNamePriceProperties = Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingMatrixWithDisplayNamePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingMatrixWithDisplayNamePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ModelType.cs index 731aa49f..c274374e 100644 --- a/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingMatrixWithDisplayNamePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MatrixWithDisplayName = new("matrix_with_display_name"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix_with_display_name" => Value.MatrixWithDisplayName, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePrice.cs b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePrice.cs index d4157cdc..f6675f72 100644 --- a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePrice.cs +++ b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingMaxGroupTieredPackagePriceProperties = Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingMaxGroupTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingMaxGroupTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,26 +58,26 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MaxGroupTieredPackageConfig + public required Dictionary MaxGroupTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "max_group_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -86,14 +85,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); } set { - this.Properties["max_group_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["max_group_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -101,17 +100,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,13 +120,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingMaxGroupTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingMaxGroupTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingMaxGroupTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingMaxGroupTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/Cadence.cs index ffae3576..2fd49d38 100644 --- a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs index f8f2c680..0e51b2af 100644 --- a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index cd18edec..dc2a8380 100644 --- a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingMaxGroupTieredPackagePriceProperties = Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingMaxGroupTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingMaxGroupTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ModelType.cs index a06583d6..e024b359 100644 --- a/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingMaxGroupTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MaxGroupTieredPackage = new("max_group_tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "max_group_tiered_package" => Value.MaxGroupTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingPackagePrice.cs b/src/Orb/Models/NewFloatingPackagePrice.cs index c10dac1a..2e02199e 100644 --- a/src/Orb/Models/NewFloatingPackagePrice.cs +++ b/src/Orb/Models/NewFloatingPackagePrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingPackagePriceProperties = Orb.Models.NewFloatingPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingPackagePrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingPackagePrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +17,16 @@ public sealed record class NewFloatingPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +36,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +55,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,29 +90,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required PackageConfig PackageConfig { get { - if (!this.Properties.TryGetValue("package_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("package_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("package_config"); } - set { this.Properties["package_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["package_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -165,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -233,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -377,15 +346,15 @@ public override void Validate() public NewFloatingPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingPackagePriceProperties/Cadence.cs index 9c8ef918..63f418d8 100644 --- a/src/Orb/Models/NewFloatingPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfig.cs index e10a17c1..dd51a49a 100644 --- a/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfigVariants/All.cs index b0c5e587..3e93644e 100644 --- a/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingPackagePriceProperties = Orb.Models.NewFloatingPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingPackagePriceProperties/ModelType.cs index 43dc02e4..eab29be0 100644 --- a/src/Orb/Models/NewFloatingPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Package = new("package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "package" => Value.Package, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingPackageWithAllocationPrice.cs b/src/Orb/Models/NewFloatingPackageWithAllocationPrice.cs index 9c0343aa..bb111b99 100644 --- a/src/Orb/Models/NewFloatingPackageWithAllocationPrice.cs +++ b/src/Orb/Models/NewFloatingPackageWithAllocationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingPackageWithAllocationPriceProperties = Orb.Models.NewFloatingPackageWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingPackageWithAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingPackageWithAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingPackageWithAllocationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,23 +94,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary PackageWithAllocationConfig + public required Dictionary PackageWithAllocationConfig { get { if ( !this.Properties.TryGetValue( "package_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -119,14 +118,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("package_with_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("package_with_allocation_config"); } set { - this.Properties["package_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["package_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingPackageWithAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingPackageWithAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingPackageWithAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingPackageWithAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/Cadence.cs index 99fd1f8f..1d9bca1e 100644 --- a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackageWithAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfig.cs index 48666ecc..8bed096f 100644 --- a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingPackageWithAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackageWithAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs index 39adfb02..a9bc1692 100644 --- a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingPackageWithAllocationPriceProperties = Orb.Models.NewFloatingPackageWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackageWithAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingPackageWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingPackageWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ModelType.cs index b3750af0..4b32393a 100644 --- a/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingPackageWithAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingPackageWithAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType PackageWithAllocation = new("package_with_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "package_with_allocation" => Value.PackageWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPrice.cs b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPrice.cs index 86ab3508..f32d6653 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPrice.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingScalableMatrixWithTieredPricingPriceProperties = Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingScalableMatrixWithTieredPricingPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewFloatingScalableMatrixWithTieredPricingPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingScalableMatrixWithTieredPricingPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -97,26 +94,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithTieredPricingConfig + public required Dictionary ScalableMatrixWithTieredPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_tiered_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -124,9 +118,7 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException( "scalable_matrix_with_tiered_pricing_config" ); @@ -134,7 +126,7 @@ public required string Name set { this.Properties["scalable_matrix_with_tiered_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -145,15 +137,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -164,15 +153,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -183,19 +169,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -206,12 +190,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -221,23 +205,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -251,17 +228,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -272,15 +250,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -290,17 +265,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,17 +280,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -334,17 +299,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -353,16 +319,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -398,17 +364,15 @@ public override void Validate() public NewFloatingScalableMatrixWithTieredPricingPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingScalableMatrixWithTieredPricingPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewFloatingScalableMatrixWithTieredPricingPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingScalableMatrixWithTieredPricingPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/Cadence.cs index 62ea41fc..77674450 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs index 3761223a..ba80011b 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs index fa5d0857..84526348 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingScalableMatrixWithTieredPricingPriceProperties = Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingScalableMatrixWithTieredPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingScalableMatrixWithTieredPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ModelType.cs index fc6fa0b9..436e5fe0 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithTieredPricingPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ScalableMatrixWithTieredPricing = new( "scalable_matrix_with_tiered_pricing" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "scalable_matrix_with_tiered_pricing" => Value.ScalableMatrixWithTieredPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPrice.cs b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPrice.cs index 3cac1556..4d1645e0 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPrice.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingScalableMatrixWithUnitPricingPriceProperties = Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingScalableMatrixWithUnitPricingPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewFloatingScalableMatrixWithUnitPricingPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingScalableMatrixWithUnitPricingPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -97,26 +94,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithUnitPricingConfig + public required Dictionary ScalableMatrixWithUnitPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_unit_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -124,9 +118,7 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException( "scalable_matrix_with_unit_pricing_config" ); @@ -134,7 +126,7 @@ public required string Name set { this.Properties["scalable_matrix_with_unit_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -145,15 +137,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -164,15 +153,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -183,19 +169,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -206,12 +190,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -221,23 +205,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -251,17 +228,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -272,15 +250,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -290,17 +265,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,17 +280,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -334,17 +299,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -353,16 +319,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -398,17 +364,15 @@ public override void Validate() public NewFloatingScalableMatrixWithUnitPricingPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingScalableMatrixWithUnitPricingPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewFloatingScalableMatrixWithUnitPricingPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingScalableMatrixWithUnitPricingPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/Cadence.cs index d98eeba1..419761e9 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs index 3caa82c9..a567b2ee 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs index 426e87df..38ffbd5c 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingScalableMatrixWithUnitPricingPriceProperties = Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingScalableMatrixWithUnitPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingScalableMatrixWithUnitPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ModelType.cs index f596f46a..26ff406d 100644 --- a/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingScalableMatrixWithUnitPricingPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingScalableMatrixWithUnitPricingPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ScalableMatrixWithUnitPricing = new( "scalable_matrix_with_unit_pricing" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "scalable_matrix_with_unit_pricing" => Value.ScalableMatrixWithUnitPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingThresholdTotalAmountPrice.cs b/src/Orb/Models/NewFloatingThresholdTotalAmountPrice.cs index 272326d3..10ef17bc 100644 --- a/src/Orb/Models/NewFloatingThresholdTotalAmountPrice.cs +++ b/src/Orb/Models/NewFloatingThresholdTotalAmountPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingThresholdTotalAmountPriceProperties = Orb.Models.NewFloatingThresholdTotalAmountPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingThresholdTotalAmountPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingThresholdTotalAmountPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingThresholdTotalAmountPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,23 +94,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary ThresholdTotalAmountConfig + public required Dictionary ThresholdTotalAmountConfig { get { if ( !this.Properties.TryGetValue( "threshold_total_amount_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -119,14 +118,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("threshold_total_amount_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("threshold_total_amount_config"); } set { - this.Properties["threshold_total_amount_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["threshold_total_amount_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingThresholdTotalAmountPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingThresholdTotalAmountPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingThresholdTotalAmountPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingThresholdTotalAmountPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/Cadence.cs index 7b20e9c9..e9c36368 100644 --- a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingThresholdTotalAmountPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfig.cs index d3c074bb..3719e5ff 100644 --- a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingThresholdTotalAmountPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingThresholdTotalAmountPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs index c1ecd231..6acd3eec 100644 --- a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingThresholdTotalAmountPriceProperties = Orb.Models.NewFloatingThresholdTotalAmountPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingThresholdTotalAmountPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingThresholdTotalAmountPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingThresholdTotalAmountPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ModelType.cs index 71e51b07..ca71ab29 100644 --- a/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingThresholdTotalAmountPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingThresholdTotalAmountPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ThresholdTotalAmount = new("threshold_total_amount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "threshold_total_amount" => Value.ThresholdTotalAmount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredBPSPrice.cs b/src/Orb/Models/NewFloatingTieredBPSPrice.cs index 73e1362b..36a95ca2 100644 --- a/src/Orb/Models/NewFloatingTieredBPSPrice.cs +++ b/src/Orb/Models/NewFloatingTieredBPSPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingTieredBPSPriceProperties = Orb.Models.NewFloatingTieredBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingTieredBPSPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,16 @@ public sealed record class NewFloatingTieredBPSPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +38,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +57,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingTieredBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,32 +93,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required TieredBPSConfig TieredBPSConfig { get { - if (!this.Properties.TryGetValue("tiered_bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_bps_config"); } - set - { - this.Properties["tiered_bps_config"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["tiered_bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -130,15 +125,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -149,15 +141,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -168,19 +157,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -191,12 +178,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -206,23 +193,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -236,17 +216,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -257,15 +238,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -275,17 +253,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -295,17 +268,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -319,17 +287,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -338,16 +307,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -380,15 +349,15 @@ public override void Validate() public NewFloatingTieredBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingTieredBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingTieredBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingTieredBPSPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/Cadence.cs index 31745af5..e2eda0d2 100644 --- a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfig.cs index 46b74588..9fa65edd 100644 --- a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingTieredBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs index 64059a74..12bec77d 100644 --- a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingTieredBPSPriceProperties = Orb.Models.NewFloatingTieredBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingTieredBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingTieredBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ModelType.cs index bfada86b..1dd9231b 100644 --- a/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingTieredBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredBPS = new("tiered_bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_bps" => Value.TieredBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredPackagePrice.cs b/src/Orb/Models/NewFloatingTieredPackagePrice.cs index 918f6468..13543d20 100644 --- a/src/Orb/Models/NewFloatingTieredPackagePrice.cs +++ b/src/Orb/Models/NewFloatingTieredPackagePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingTieredPackagePriceProperties = Orb.Models.NewFloatingTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingTieredPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,37 +94,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageConfig + public required Dictionary TieredPackageConfig { get { - if ( - !this.Properties.TryGetValue("tiered_package_config", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("tiered_package_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_config"); - } - set - { - this.Properties["tiered_package_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_package_config"); } + set { this.Properties["tiered_package_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,15 +126,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,15 +142,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -173,19 +158,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -196,12 +179,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -211,23 +194,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -241,17 +217,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +239,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +254,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +269,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +288,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +308,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -388,15 +353,15 @@ public override void Validate() public NewFloatingTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/Cadence.cs index 10559d33..48133fb9 100644 --- a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfig.cs index 7992c3f8..1fa25ce7 100644 --- a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index a86edecf..e020304a 100644 --- a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingTieredPackagePriceProperties = Orb.Models.NewFloatingTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ModelType.cs index 665735ee..ce47c578 100644 --- a/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredPackage = new("tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_package" => Value.TieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPrice.cs b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPrice.cs index b2707491..ca19d4ab 100644 --- a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPrice.cs +++ b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingTieredPackageWithMinimumPriceProperties = Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingTieredPackageWithMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewFloatingTieredPackageWithMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingTieredPackageWithMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -97,23 +94,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageWithMinimumConfig + public required Dictionary TieredPackageWithMinimumConfig { get { if ( !this.Properties.TryGetValue( "tiered_package_with_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -121,14 +118,13 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); } set { this.Properties["tiered_package_with_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -139,15 +135,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -158,15 +151,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -177,19 +167,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -200,12 +188,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -215,23 +203,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -245,17 +226,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +248,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +263,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,17 +278,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -328,17 +297,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +317,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -392,17 +362,15 @@ public override void Validate() public NewFloatingTieredPackageWithMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingTieredPackageWithMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewFloatingTieredPackageWithMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingTieredPackageWithMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/Cadence.cs index a905426f..817bd038 100644 --- a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs index f2198136..1fe62e8c 100644 --- a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs index a872952f..36014a9f 100644 --- a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingTieredPackageWithMinimumPriceProperties = Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingTieredPackageWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingTieredPackageWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ModelType.cs index fdf30cc2..d1823242 100644 --- a/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingTieredPackageWithMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPackageWithMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredPackageWithMinimum = new("tiered_package_with_minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_package_with_minimum" => Value.TieredPackageWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredPrice.cs b/src/Orb/Models/NewFloatingTieredPrice.cs index cd28d77d..ba3c584f 100644 --- a/src/Orb/Models/NewFloatingTieredPrice.cs +++ b/src/Orb/Models/NewFloatingTieredPrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingTieredPriceProperties = Orb.Models.NewFloatingTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingTieredPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingTieredPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +17,16 @@ public sealed record class NewFloatingTieredPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +36,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +55,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingTieredPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,29 +90,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required TieredConfig TieredConfig { get { - if (!this.Properties.TryGetValue("tiered_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_config"); } - set { this.Properties["tiered_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiered_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -165,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -233,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -377,15 +346,15 @@ public override void Validate() public NewFloatingTieredPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingTieredPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingTieredPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingTieredPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingTieredPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingTieredPriceProperties/Cadence.cs index 2571caea..03682b13 100644 --- a/src/Orb/Models/NewFloatingTieredPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingTieredPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfig.cs index b3a12991..556ed37b 100644 --- a/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingTieredPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfigVariants/All.cs index fb36dd24..51d23d2d 100644 --- a/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingTieredPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingTieredPriceProperties = Orb.Models.NewFloatingTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingTieredPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingTieredPriceProperties/ModelType.cs index dda077e6..0efc141c 100644 --- a/src/Orb/Models/NewFloatingTieredPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingTieredPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Tiered = new("tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered" => Value.Tiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredWithMinimumPrice.cs b/src/Orb/Models/NewFloatingTieredWithMinimumPrice.cs index 5ede2bf0..1e0ff986 100644 --- a/src/Orb/Models/NewFloatingTieredWithMinimumPrice.cs +++ b/src/Orb/Models/NewFloatingTieredWithMinimumPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingTieredWithMinimumPriceProperties = Orb.Models.NewFloatingTieredWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingTieredWithMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingTieredWithMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingTieredWithMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,37 +94,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithMinimumConfig + public required Dictionary TieredWithMinimumConfig { get { - if ( - !this.Properties.TryGetValue( - "tiered_with_minimum_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("tiered_with_minimum_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_with_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); } set { - this.Properties["tiered_with_minimum_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["tiered_with_minimum_config"] = JsonSerializer.SerializeToElement( value ); } @@ -138,15 +131,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,15 +147,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,19 +163,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -199,12 +184,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -214,23 +199,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -244,17 +222,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +244,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +259,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,17 +274,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,17 +293,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +313,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -391,15 +358,15 @@ public override void Validate() public NewFloatingTieredWithMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingTieredWithMinimumPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingTieredWithMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingTieredWithMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/Cadence.cs index e89df043..e6a23384 100644 --- a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfig.cs index 0610b148..167b9e73 100644 --- a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingTieredWithMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 1c0cddb4..8a154911 100644 --- a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingTieredWithMinimumPriceProperties = Orb.Models.NewFloatingTieredWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingTieredWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingTieredWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ModelType.cs index e305e789..331693c8 100644 --- a/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingTieredWithMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredWithMinimum = new("tiered_with_minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_with_minimum" => Value.TieredWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredWithProrationPrice.cs b/src/Orb/Models/NewFloatingTieredWithProrationPrice.cs index ff63eff2..1849e510 100644 --- a/src/Orb/Models/NewFloatingTieredWithProrationPrice.cs +++ b/src/Orb/Models/NewFloatingTieredWithProrationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingTieredWithProrationPriceProperties = Orb.Models.NewFloatingTieredWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingTieredWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingTieredWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingTieredWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,23 +94,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithProrationConfig + public required Dictionary TieredWithProrationConfig { get { if ( !this.Properties.TryGetValue( "tiered_with_proration_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -119,14 +118,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_with_proration_config"); } set { - this.Properties["tiered_with_proration_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["tiered_with_proration_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -137,15 +136,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +152,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,19 +168,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -198,12 +189,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -213,23 +204,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -243,17 +227,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +249,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +264,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,17 +279,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,17 +298,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +318,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -390,15 +363,15 @@ public override void Validate() public NewFloatingTieredWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingTieredWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingTieredWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingTieredWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/Cadence.cs index d7756633..fe94696d 100644 --- a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfig.cs index 71fb7dc9..8ec22efc 100644 --- a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingTieredWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index ee23fe1a..8d4cceaa 100644 --- a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingTieredWithProrationPriceProperties = Orb.Models.NewFloatingTieredWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingTieredWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingTieredWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ModelType.cs index b7bdc9ef..4d6e9891 100644 --- a/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingTieredWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingTieredWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredWithProration = new("tiered_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_with_proration" => Value.TieredWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingUnitPrice.cs b/src/Orb/Models/NewFloatingUnitPrice.cs index 23fa04ec..bad23a9b 100644 --- a/src/Orb/Models/NewFloatingUnitPrice.cs +++ b/src/Orb/Models/NewFloatingUnitPrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingUnitPriceProperties = Orb.Models.NewFloatingUnitPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewFloatingUnitPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewFloatingUnitPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +17,16 @@ public sealed record class NewFloatingUnitPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +36,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +55,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingUnitPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,29 +90,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required UnitConfig UnitConfig { get { - if (!this.Properties.TryGetValue("unit_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_config"); } - set { this.Properties["unit_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,15 +122,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,15 +138,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -165,19 +154,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +175,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +190,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -233,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -377,16 +346,14 @@ public override void Validate() public NewFloatingUnitPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingUnitPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingUnitPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewFloatingUnitPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewFloatingUnitPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewFloatingUnitPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingUnitPriceProperties/Cadence.cs index 7e0b1f52..539b90e1 100644 --- a/src/Orb/Models/NewFloatingUnitPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingUnitPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfig.cs index a07a6146..7cd24200 100644 --- a/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingUnitPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfigVariants/All.cs index 7aa62a48..85cc34a9 100644 --- a/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingUnitPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingUnitPriceProperties = Orb.Models.NewFloatingUnitPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingUnitPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingUnitPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingUnitPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingUnitPriceProperties/ModelType.cs index d2c8fa4f..0586079b 100644 --- a/src/Orb/Models/NewFloatingUnitPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingUnitPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Unit = new("unit"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit" => Value.Unit, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingUnitWithPercentPrice.cs b/src/Orb/Models/NewFloatingUnitWithPercentPrice.cs index d10f9069..b61a56bd 100644 --- a/src/Orb/Models/NewFloatingUnitWithPercentPrice.cs +++ b/src/Orb/Models/NewFloatingUnitWithPercentPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingUnitWithPercentPriceProperties = Orb.Models.NewFloatingUnitWithPercentPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingUnitWithPercentPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingUnitWithPercentPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingUnitWithPercentPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,39 +94,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithPercentConfig + public required Dictionary UnitWithPercentConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_percent_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("unit_with_percent_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_with_percent_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_percent_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("unit_with_percent_config"); } set { - this.Properties["unit_with_percent_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["unit_with_percent_config"] = JsonSerializer.SerializeToElement(value); } } @@ -138,15 +129,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,15 +145,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,19 +161,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -199,12 +182,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -214,23 +197,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -244,17 +220,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +242,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +257,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,17 +272,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,17 +291,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +311,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -391,15 +356,15 @@ public override void Validate() public NewFloatingUnitWithPercentPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingUnitWithPercentPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingUnitWithPercentPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingUnitWithPercentPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/Cadence.cs index 34937ece..7224bf9a 100644 --- a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithPercentPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfig.cs index 922cfb2a..fc9d9d88 100644 --- a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingUnitWithPercentPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithPercentPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs index f06e3f32..8355d2fb 100644 --- a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingUnitWithPercentPriceProperties = Orb.Models.NewFloatingUnitWithPercentPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithPercentPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingUnitWithPercentPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingUnitWithPercentPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ModelType.cs index 5ac1cba7..20971f99 100644 --- a/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingUnitWithPercentPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithPercentPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType UnitWithPercent = new("unit_with_percent"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit_with_percent" => Value.UnitWithPercent, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingUnitWithProrationPrice.cs b/src/Orb/Models/NewFloatingUnitWithProrationPrice.cs index b22ebb5f..54faf834 100644 --- a/src/Orb/Models/NewFloatingUnitWithProrationPrice.cs +++ b/src/Orb/Models/NewFloatingUnitWithProrationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewFloatingUnitWithProrationPriceProperties = Orb.Models.NewFloatingUnitWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewFloatingUnitWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewFloatingUnitWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -59,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewFloatingUnitWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -95,37 +94,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithProrationConfig + public required Dictionary UnitWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_proration_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("unit_with_proration_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("unit_with_proration_config"); } set { - this.Properties["unit_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["unit_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -138,15 +131,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,15 +147,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -176,19 +163,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -199,12 +184,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -214,23 +199,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -244,17 +222,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +244,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +259,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,17 +274,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,17 +293,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +313,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -391,15 +358,15 @@ public override void Validate() public NewFloatingUnitWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewFloatingUnitWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewFloatingUnitWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewFloatingUnitWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/Cadence.cs index 3c35fd3d..8c8392c4 100644 --- a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfig.cs index a46202de..8fbc4ec5 100644 --- a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewFloatingUnitWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 1176ed0e..8cb9893e 100644 --- a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewFloatingUnitWithProrationPriceProperties = Orb.Models.NewFloatingUnitWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewFloatingUnitWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewFloatingUnitWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ModelType.cs index 7f8912d1..4683422a 100644 --- a/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewFloatingUnitWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewFloatingUnitWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType UnitWithProration = new("unit_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit_with_proration" => Value.UnitWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewMaximum.cs b/src/Orb/Models/NewMaximum.cs index 6a614172..3f441fc2 100644 --- a/src/Orb/Models/NewMaximum.cs +++ b/src/Orb/Models/NewMaximum.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewMaximumProperties = Orb.Models.NewMaximumProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewMaximum : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewMaximum : ModelBase, IFromRaw { public required NewMaximumProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("maximum_amount"); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,50 +49,42 @@ public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("applies_to_all", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_all", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applies_to_all"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applies_to_all"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of item IDs to which this adjustment applies. /// - public Generic::List? AppliesToItemIDs + public List? AppliesToItemIDs { get { - if (!this.Properties.TryGetValue("applies_to_item_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_item_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_item_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_item_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of price IDs to which this adjustment applies. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,27 +94,27 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of filters that determine which prices this adjustment will apply to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -134,15 +125,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -152,12 +140,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -185,16 +173,14 @@ public override void Validate() public NewMaximum() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewMaximum(Generic::Dictionary properties) + [SetsRequiredMembers] + NewMaximum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewMaximum FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewMaximum FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewMaximumProperties/AdjustmentType.cs b/src/Orb/Models/NewMaximumProperties/AdjustmentType.cs index 5f2beaa0..35f8542f 100644 --- a/src/Orb/Models/NewMaximumProperties/AdjustmentType.cs +++ b/src/Orb/Models/NewMaximumProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewMaximumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType Maximum = new("maximum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "maximum" => Value.Maximum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewMaximumProperties/AppliesToAll.cs b/src/Orb/Models/NewMaximumProperties/AppliesToAll.cs index 2754e030..d7466f7f 100644 --- a/src/Orb/Models/NewMaximumProperties/AppliesToAll.cs +++ b/src/Orb/Models/NewMaximumProperties/AppliesToAll.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewMaximumProperties; /// /// If set, the adjustment will apply to every price on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AppliesToAll(bool value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AppliesToAll(bool value) : IEnum { public static readonly AppliesToAll True = new(true); @@ -23,7 +22,7 @@ public Value Known() => _value switch { true => Value.True, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public bool Raw() diff --git a/src/Orb/Models/NewMaximumProperties/PriceType.cs b/src/Orb/Models/NewMaximumProperties/PriceType.cs index 2db7c9ab..1047f70e 100644 --- a/src/Orb/Models/NewMaximumProperties/PriceType.cs +++ b/src/Orb/Models/NewMaximumProperties/PriceType.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewMaximumProperties; /// /// If set, only prices of the specified type will have the adjustment applied. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType Usage = new("usage"); @@ -39,7 +38,7 @@ public Value Known() => "fixed_in_arrears" => Value.FixedInArrears, "fixed" => Value.Fixed, "in_arrears" => Value.InArrears, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewMinimum.cs b/src/Orb/Models/NewMinimum.cs index 04d051ee..67e5e444 100644 --- a/src/Orb/Models/NewMinimum.cs +++ b/src/Orb/Models/NewMinimum.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewMinimumProperties = Orb.Models.NewMinimumProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewMinimum : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewMinimum : ModelBase, IFromRaw { public required NewMinimumProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,32 +33,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("minimum_amount"); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -69,50 +68,42 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("applies_to_all", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_all", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applies_to_all"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applies_to_all"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of item IDs to which this adjustment applies. /// - public Generic::List? AppliesToItemIDs + public List? AppliesToItemIDs { get { - if (!this.Properties.TryGetValue("applies_to_item_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_item_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_item_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_item_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of price IDs to which this adjustment applies. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,27 +113,27 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of filters that determine which prices this adjustment will apply to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -153,15 +144,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -171,12 +159,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -205,16 +193,14 @@ public override void Validate() public NewMinimum() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewMinimum(Generic::Dictionary properties) + [SetsRequiredMembers] + NewMinimum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewMinimum FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewMinimum FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewMinimumProperties/AdjustmentType.cs b/src/Orb/Models/NewMinimumProperties/AdjustmentType.cs index 49d7b6f2..4aed1a25 100644 --- a/src/Orb/Models/NewMinimumProperties/AdjustmentType.cs +++ b/src/Orb/Models/NewMinimumProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType Minimum = new("minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "minimum" => Value.Minimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewMinimumProperties/AppliesToAll.cs b/src/Orb/Models/NewMinimumProperties/AppliesToAll.cs index 3ec34a37..02a68bd7 100644 --- a/src/Orb/Models/NewMinimumProperties/AppliesToAll.cs +++ b/src/Orb/Models/NewMinimumProperties/AppliesToAll.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewMinimumProperties; /// /// If set, the adjustment will apply to every price on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AppliesToAll(bool value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AppliesToAll(bool value) : IEnum { public static readonly AppliesToAll True = new(true); @@ -23,7 +22,7 @@ public Value Known() => _value switch { true => Value.True, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public bool Raw() diff --git a/src/Orb/Models/NewMinimumProperties/PriceType.cs b/src/Orb/Models/NewMinimumProperties/PriceType.cs index 15ac6dc8..4f058a8d 100644 --- a/src/Orb/Models/NewMinimumProperties/PriceType.cs +++ b/src/Orb/Models/NewMinimumProperties/PriceType.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewMinimumProperties; /// /// If set, only prices of the specified type will have the adjustment applied. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType Usage = new("usage"); @@ -39,7 +38,7 @@ public Value Known() => "fixed_in_arrears" => Value.FixedInArrears, "fixed" => Value.Fixed, "in_arrears" => Value.InArrears, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPercentageDiscount.cs b/src/Orb/Models/NewPercentageDiscount.cs index 3652eb2a..10a3d8d8 100644 --- a/src/Orb/Models/NewPercentageDiscount.cs +++ b/src/Orb/Models/NewPercentageDiscount.cs @@ -1,51 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPercentageDiscountProperties = Orb.Models.NewPercentageDiscountProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPercentageDiscount - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPercentageDiscount : ModelBase, IFromRaw { public required NewPercentageDiscountProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -55,52 +49,44 @@ public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("applies_to_all", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_all", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set { this.Properties["applies_to_all"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applies_to_all"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of item IDs to which this adjustment applies. /// - public Generic::List? AppliesToItemIDs + public List? AppliesToItemIDs { get { - if (!this.Properties.TryGetValue("applies_to_item_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_item_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_item_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_item_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of price IDs to which this adjustment applies. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,27 +96,27 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of filters that determine which prices this adjustment will apply to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -141,15 +127,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -159,14 +142,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -194,16 +175,14 @@ public override void Validate() public NewPercentageDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPercentageDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPercentageDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPercentageDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPercentageDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPercentageDiscountProperties/AdjustmentType.cs b/src/Orb/Models/NewPercentageDiscountProperties/AdjustmentType.cs index 440c0e12..437e5d43 100644 --- a/src/Orb/Models/NewPercentageDiscountProperties/AdjustmentType.cs +++ b/src/Orb/Models/NewPercentageDiscountProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPercentageDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType PercentageDiscount = new("percentage_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage_discount" => Value.PercentageDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPercentageDiscountProperties/AppliesToAll.cs b/src/Orb/Models/NewPercentageDiscountProperties/AppliesToAll.cs index 47f42673..e4d8bd06 100644 --- a/src/Orb/Models/NewPercentageDiscountProperties/AppliesToAll.cs +++ b/src/Orb/Models/NewPercentageDiscountProperties/AppliesToAll.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPercentageDiscountProperties; /// /// If set, the adjustment will apply to every price on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AppliesToAll(bool value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AppliesToAll(bool value) : IEnum { public static readonly AppliesToAll True = new(true); @@ -23,7 +22,7 @@ public Value Known() => _value switch { true => Value.True, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public bool Raw() diff --git a/src/Orb/Models/NewPercentageDiscountProperties/PriceType.cs b/src/Orb/Models/NewPercentageDiscountProperties/PriceType.cs index 7ca0643b..52db554c 100644 --- a/src/Orb/Models/NewPercentageDiscountProperties/PriceType.cs +++ b/src/Orb/Models/NewPercentageDiscountProperties/PriceType.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPercentageDiscountProperties; /// /// If set, only prices of the specified type will have the adjustment applied. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType Usage = new("usage"); @@ -39,7 +38,7 @@ public Value Known() => "fixed_in_arrears" => Value.FixedInArrears, "fixed" => Value.Fixed, "in_arrears" => Value.InArrears, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBPSPrice.cs b/src/Orb/Models/NewPlanBPSPrice.cs index b6c83e65..b3ee44a2 100644 --- a/src/Orb/Models/NewPlanBPSPrice.cs +++ b/src/Orb/Models/NewPlanBPSPrice.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanBPSPriceProperties = Orb.Models.NewPlanBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanBPSPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanBPSPrice : ModelBase, IFromRaw { public required BPSConfig BPSConfig { get { - if (!this.Properties.TryGetValue("bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bps_config"); } - set { this.Properties["bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,16 +33,16 @@ public required BPSConfig BPSConfig { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,32 +52,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -88,13 +87,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -123,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -142,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -165,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -180,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -208,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -226,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -247,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -265,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -285,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -309,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -328,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -348,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -387,16 +360,14 @@ public override void Validate() public NewPlanBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanBPSPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanBPSPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanBPSPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanBPSPriceProperties/Cadence.cs index a9ebcf15..20418b3e 100644 --- a/src/Orb/Models/NewPlanBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfig.cs index c1fcdde2..c2874099 100644 --- a/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfigVariants/All.cs index 50b72d11..c22842a6 100644 --- a/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanBPSPriceProperties = Orb.Models.NewPlanBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanBPSPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanBPSPriceProperties/ModelType.cs index a84f7656..c58b9ba2 100644 --- a/src/Orb/Models/NewPlanBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BPS = new("bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bps" => Value.BPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBulkBPSPrice.cs b/src/Orb/Models/NewPlanBulkBPSPrice.cs index a428001d..cac8cea4 100644 --- a/src/Orb/Models/NewPlanBulkBPSPrice.cs +++ b/src/Orb/Models/NewPlanBulkBPSPrice.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanBulkBPSPriceProperties = Orb.Models.NewPlanBulkBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanBulkBPSPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanBulkBPSPrice : ModelBase, IFromRaw { public required BulkBPSConfig BulkBPSConfig { get { - if (!this.Properties.TryGetValue("bulk_bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bulk_bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bulk_bps_config"); } - set { this.Properties["bulk_bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,16 +33,16 @@ public required BulkBPSConfig BulkBPSConfig { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,33 +52,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanBulkBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -89,13 +87,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -143,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -166,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -181,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -209,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -227,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -248,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -266,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -286,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -329,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -349,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -388,16 +360,14 @@ public override void Validate() public NewPlanBulkBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanBulkBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanBulkBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanBulkBPSPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanBulkBPSPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanBulkBPSPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanBulkBPSPriceProperties/Cadence.cs index 67b75234..37dda7e1 100644 --- a/src/Orb/Models/NewPlanBulkBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanBulkBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfig.cs index f1215e94..7611d53a 100644 --- a/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanBulkBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs index 589c0cfa..3ea8a6a5 100644 --- a/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanBulkBPSPriceProperties = Orb.Models.NewPlanBulkBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanBulkBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanBulkBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanBulkBPSPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanBulkBPSPriceProperties/ModelType.cs index f52acc5c..0d3f981f 100644 --- a/src/Orb/Models/NewPlanBulkBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanBulkBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BulkBPS = new("bulk_bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk_bps" => Value.BulkBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBulkPrice.cs b/src/Orb/Models/NewPlanBulkPrice.cs index eb59b823..63ed3894 100644 --- a/src/Orb/Models/NewPlanBulkPrice.cs +++ b/src/Orb/Models/NewPlanBulkPrice.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanBulkPriceProperties = Orb.Models.NewPlanBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanBulkPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanBulkPrice : ModelBase, IFromRaw { public required BulkConfig BulkConfig { get { - if (!this.Properties.TryGetValue("bulk_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bulk_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bulk_config"); } - set { this.Properties["bulk_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,16 +33,16 @@ public required BulkConfig BulkConfig { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,32 +52,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanBulkPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -88,13 +87,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -123,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -142,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -165,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -180,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -208,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -226,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -247,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -265,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -285,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -309,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -328,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -348,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -387,16 +360,14 @@ public override void Validate() public NewPlanBulkPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanBulkPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanBulkPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanBulkPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanBulkPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanBulkPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanBulkPriceProperties/Cadence.cs index a7837baa..54ab14cd 100644 --- a/src/Orb/Models/NewPlanBulkPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanBulkPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfig.cs index 4c8893da..6081d46e 100644 --- a/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanBulkPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfigVariants/All.cs index 8453a2af..25288f8f 100644 --- a/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanBulkPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanBulkPriceProperties = Orb.Models.NewPlanBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanBulkPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanBulkPriceProperties/ModelType.cs index 386dacdc..3d0d1970 100644 --- a/src/Orb/Models/NewPlanBulkPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanBulkPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Bulk = new("bulk"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk" => Value.Bulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBulkWithProrationPrice.cs b/src/Orb/Models/NewPlanBulkWithProrationPrice.cs index c1df4585..809ba53f 100644 --- a/src/Orb/Models/NewPlanBulkWithProrationPrice.cs +++ b/src/Orb/Models/NewPlanBulkWithProrationPrice.cs @@ -1,40 +1,33 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanBulkWithProrationPriceProperties = Orb.Models.NewPlanBulkWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanBulkWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::Dictionary BulkWithProrationConfig + public required Dictionary BulkWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "bulk_with_proration_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("bulk_with_proration_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("bulk_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("bulk_with_proration_config"); } set { - this.Properties["bulk_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["bulk_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -47,17 +40,17 @@ public sealed record class NewPlanBulkWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -67,33 +60,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanBulkWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,13 +96,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,15 +112,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +128,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,19 +144,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +165,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +180,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,12 +201,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -241,17 +219,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +241,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +256,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +271,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +290,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +310,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +330,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +372,15 @@ public override void Validate() public NewPlanBulkWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanBulkWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanBulkWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanBulkWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/Cadence.cs index e45107eb..8fb779ab 100644 --- a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfig.cs index 55eedc4c..85772045 100644 --- a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanBulkWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 16623954..85fa525b 100644 --- a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanBulkWithProrationPriceProperties = Orb.Models.NewPlanBulkWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanBulkWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanBulkWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ModelType.cs index c92b7385..15138796 100644 --- a/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanBulkWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanBulkWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BulkWithProration = new("bulk_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk_with_proration" => Value.BulkWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanCumulativeGroupedBulkPrice.cs b/src/Orb/Models/NewPlanCumulativeGroupedBulkPrice.cs index a0f68cba..4295f0f6 100644 --- a/src/Orb/Models/NewPlanCumulativeGroupedBulkPrice.cs +++ b/src/Orb/Models/NewPlanCumulativeGroupedBulkPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanCumulativeGroupedBulkPriceProperties = Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanCumulativeGroupedBulkPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,27 +19,27 @@ public sealed record class NewPlanCumulativeGroupedBulkPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary CumulativeGroupedBulkConfig + public required Dictionary CumulativeGroupedBulkConfig { get { if ( !this.Properties.TryGetValue( "cumulative_grouped_bulk_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -48,14 +47,14 @@ public sealed record class NewPlanCumulativeGroupedBulkPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); } set { - this.Properties["cumulative_grouped_bulk_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["cumulative_grouped_bulk_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -66,33 +65,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanCumulativeGroupedBulkPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanCumulativeGroupedBulkPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanCumulativeGroupedBulkPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanCumulativeGroupedBulkPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanCumulativeGroupedBulkPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/Cadence.cs index dc5fb5a7..cd98cca3 100644 --- a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs index 576958ee..72d01a44 100644 --- a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs index 838a16c6..1a635a2a 100644 --- a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanCumulativeGroupedBulkPriceProperties = Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanCumulativeGroupedBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanCumulativeGroupedBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ModelType.cs index 23551e1d..328c2f60 100644 --- a/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanCumulativeGroupedBulkPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanCumulativeGroupedBulkPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType CumulativeGroupedBulk = new("cumulative_grouped_bulk"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "cumulative_grouped_bulk" => Value.CumulativeGroupedBulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedAllocationPrice.cs b/src/Orb/Models/NewPlanGroupedAllocationPrice.cs index b573a499..91b7114d 100644 --- a/src/Orb/Models/NewPlanGroupedAllocationPrice.cs +++ b/src/Orb/Models/NewPlanGroupedAllocationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanGroupedAllocationPriceProperties = Orb.Models.NewPlanGroupedAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanGroupedAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,43 +19,35 @@ public sealed record class NewPlanGroupedAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedAllocationConfig + public required Dictionary GroupedAllocationConfig { get { - if ( - !this.Properties.TryGetValue( - "grouped_allocation_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("grouped_allocation_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouped_allocation_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_allocation_config"); } set { - this.Properties["grouped_allocation_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["grouped_allocation_config"] = JsonSerializer.SerializeToElement(value); } } @@ -67,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanGroupedAllocationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,13 +94,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,15 +110,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +126,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,19 +142,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +163,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +178,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,12 +199,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -241,17 +217,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +239,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +254,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +269,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +288,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +308,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +328,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +370,15 @@ public override void Validate() public NewPlanGroupedAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanGroupedAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanGroupedAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanGroupedAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/Cadence.cs index 598a066d..1ebd539c 100644 --- a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfig.cs index b01958e8..4f7c1e2a 100644 --- a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanGroupedAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs index b1050831..7c05bbd1 100644 --- a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanGroupedAllocationPriceProperties = Orb.Models.NewPlanGroupedAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanGroupedAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanGroupedAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ModelType.cs index 526cb15f..8c39e87f 100644 --- a/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanGroupedAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedAllocation = new("grouped_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_allocation" => Value.GroupedAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedTieredPackagePrice.cs b/src/Orb/Models/NewPlanGroupedTieredPackagePrice.cs index 71d3aaf4..70c8e964 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPackagePrice.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPackagePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanGroupedTieredPackagePriceProperties = Orb.Models.NewPlanGroupedTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanGroupedTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,27 +19,27 @@ public sealed record class NewPlanGroupedTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredPackageConfig + public required Dictionary GroupedTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "grouped_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -48,14 +47,14 @@ public sealed record class NewPlanGroupedTieredPackagePrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); } set { - this.Properties["grouped_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["grouped_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -66,33 +65,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanGroupedTieredPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanGroupedTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanGroupedTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanGroupedTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanGroupedTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/Cadence.cs index b978517d..290a157e 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfig.cs index e5779638..9c131127 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanGroupedTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index bb29c208..a9f8a487 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanGroupedTieredPackagePriceProperties = Orb.Models.NewPlanGroupedTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanGroupedTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanGroupedTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ModelType.cs index 2b743203..4070cd68 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedTieredPackage = new("grouped_tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_tiered_package" => Value.GroupedTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedTieredPrice.cs b/src/Orb/Models/NewPlanGroupedTieredPrice.cs index 4e8f4f50..3e3d04b7 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPrice.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanGroupedTieredPriceProperties = Orb.Models.NewPlanGroupedTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanGroupedTieredPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,41 +19,32 @@ public sealed record class NewPlanGroupedTieredPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredConfig + public required Dictionary GroupedTieredConfig { get { - if ( - !this.Properties.TryGetValue("grouped_tiered_config", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("grouped_tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouped_tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_config"); - } - set - { - this.Properties["grouped_tiered_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_tiered_config"); } + set { this.Properties["grouped_tiered_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -64,33 +54,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanGroupedTieredPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -100,13 +90,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,15 +106,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,15 +122,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,19 +138,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -177,12 +159,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -192,23 +174,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -220,12 +195,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -238,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -259,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -277,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -297,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -321,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -340,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -360,12 +324,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -402,15 +366,15 @@ public override void Validate() public NewPlanGroupedTieredPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanGroupedTieredPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanGroupedTieredPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanGroupedTieredPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/Cadence.cs index c2f5d73d..53c3e88c 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfig.cs index 0b020c74..0ae6c74d 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanGroupedTieredPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs index 7c94cb32..a2c4ff44 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanGroupedTieredPriceProperties = Orb.Models.NewPlanGroupedTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanGroupedTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanGroupedTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ModelType.cs index 804c3b9d..c6cc6472 100644 --- a/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanGroupedTieredPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedTieredPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedTiered = new("grouped_tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_tiered" => Value.GroupedTiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPrice.cs b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPrice.cs index 817a8e0a..3c8b0b03 100644 --- a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPrice.cs +++ b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanGroupedWithMeteredMinimumPriceProperties = Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanGroupedWithMeteredMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,27 +19,27 @@ public sealed record class NewPlanGroupedWithMeteredMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithMeteredMinimumConfig + public required Dictionary GroupedWithMeteredMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_metered_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -48,14 +47,13 @@ public sealed record class NewPlanGroupedWithMeteredMinimumPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); } set { this.Properties["grouped_with_metered_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -66,33 +64,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanGroupedWithMeteredMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,13 +100,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -118,15 +116,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +132,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +148,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +169,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +184,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +205,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +223,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +245,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +260,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +275,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +294,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +314,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +334,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +376,15 @@ public override void Validate() public NewPlanGroupedWithMeteredMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanGroupedWithMeteredMinimumPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanGroupedWithMeteredMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanGroupedWithMeteredMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/Cadence.cs index 7705808b..2522cd5f 100644 --- a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs index 74a3aeb7..33de8e0b 100644 --- a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 910fbe89..72c968bd 100644 --- a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanGroupedWithMeteredMinimumPriceProperties = Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanGroupedWithMeteredMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanGroupedWithMeteredMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ModelType.cs index 99e5c149..92982a72 100644 --- a/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanGroupedWithMeteredMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithMeteredMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedWithMeteredMinimum = new( "grouped_with_metered_minimum" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "grouped_with_metered_minimum" => Value.GroupedWithMeteredMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPrice.cs b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPrice.cs index 434b738e..33df0f2b 100644 --- a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPrice.cs +++ b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanGroupedWithProratedMinimumPriceProperties = Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanGroupedWithProratedMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,27 +19,27 @@ public sealed record class NewPlanGroupedWithProratedMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithProratedMinimumConfig + public required Dictionary GroupedWithProratedMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_prorated_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -48,15 +47,13 @@ public sealed record class NewPlanGroupedWithProratedMinimumPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("grouped_with_prorated_minimum_config"); } set { this.Properties["grouped_with_prorated_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -67,33 +64,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanGroupedWithProratedMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,13 +100,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,15 +116,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +132,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,19 +148,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +169,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +184,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,12 +205,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -241,17 +223,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +245,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +260,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +275,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +294,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +314,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +334,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,17 +376,15 @@ public override void Validate() public NewPlanGroupedWithProratedMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanGroupedWithProratedMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewPlanGroupedWithProratedMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanGroupedWithProratedMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/Cadence.cs index b6e23904..661ab5b3 100644 --- a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs index 19ff2e48..e5902c61 100644 --- a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs index f38d4f4e..233fbe0e 100644 --- a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanGroupedWithProratedMinimumPriceProperties = Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanGroupedWithProratedMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanGroupedWithProratedMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ModelType.cs index 8d40bad1..626d542e 100644 --- a/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanGroupedWithProratedMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanGroupedWithProratedMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedWithProratedMinimum = new( "grouped_with_prorated_minimum" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "grouped_with_prorated_minimum" => Value.GroupedWithProratedMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMatrixPrice.cs b/src/Orb/Models/NewPlanMatrixPrice.cs index 24c66f60..1ea925a2 100644 --- a/src/Orb/Models/NewPlanMatrixPrice.cs +++ b/src/Orb/Models/NewPlanMatrixPrice.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanMatrixPriceProperties = Orb.Models.NewPlanMatrixPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanMatrixPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanMatrixPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -18,16 +17,16 @@ public sealed record class NewPlanMatrixPrice : Orb::ModelBase, Orb::IFromRaw(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,49 +36,48 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required MatrixConfig MatrixConfig { get { - if (!this.Properties.TryGetValue("matrix_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("matrix_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "matrix_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_config"); } - set { this.Properties["matrix_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_config"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanMatrixPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -89,13 +87,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -143,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -166,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -181,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -209,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -227,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -248,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -266,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -286,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -329,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -349,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -388,16 +360,14 @@ public override void Validate() public NewPlanMatrixPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanMatrixPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanMatrixPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanMatrixPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanMatrixPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanMatrixPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanMatrixPriceProperties/Cadence.cs index 14867bd0..8beb6365 100644 --- a/src/Orb/Models/NewPlanMatrixPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanMatrixPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfig.cs index 3f2a4be4..fc421d61 100644 --- a/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanMatrixPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfigVariants/All.cs index 1c5a7af9..c6b7ba9c 100644 --- a/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanMatrixPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanMatrixPriceProperties = Orb.Models.NewPlanMatrixPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanMatrixPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanMatrixPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanMatrixPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanMatrixPriceProperties/ModelType.cs index 3dc75dbf..d4269c4b 100644 --- a/src/Orb/Models/NewPlanMatrixPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanMatrixPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Matrix = new("matrix"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix" => Value.Matrix, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMatrixWithAllocationPrice.cs b/src/Orb/Models/NewPlanMatrixWithAllocationPrice.cs index 46d83090..a40c8d05 100644 --- a/src/Orb/Models/NewPlanMatrixWithAllocationPrice.cs +++ b/src/Orb/Models/NewPlanMatrixWithAllocationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanMatrixWithAllocationPriceProperties = Orb.Models.NewPlanMatrixWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanMatrixWithAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanMatrixWithAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required MatrixWithAllocationConfig MatrixWithAllocationConfig @@ -59,7 +58,7 @@ public required MatrixWithAllocationConfig MatrixWithAllocationConfig if ( !this.Properties.TryGetValue( "matrix_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -67,13 +66,14 @@ public required MatrixWithAllocationConfig MatrixWithAllocationConfig "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_with_allocation_config"); } set { - this.Properties["matrix_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -81,17 +81,17 @@ public required MatrixWithAllocationConfig MatrixWithAllocationConfig { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -178,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -193,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -221,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -239,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -260,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -278,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -322,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -341,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -361,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -400,15 +374,15 @@ public override void Validate() public NewPlanMatrixWithAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanMatrixWithAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanMatrixWithAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanMatrixWithAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/Cadence.cs index 403a4160..4ab5411c 100644 --- a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfig.cs index 1b9ad410..4ed6d879 100644 --- a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanMatrixWithAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs index 903f2489..7f14800f 100644 --- a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanMatrixWithAllocationPriceProperties = Orb.Models.NewPlanMatrixWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanMatrixWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanMatrixWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ModelType.cs index 20011896..55778857 100644 --- a/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanMatrixWithAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MatrixWithAllocation = new("matrix_with_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix_with_allocation" => Value.MatrixWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMatrixWithDisplayNamePrice.cs b/src/Orb/Models/NewPlanMatrixWithDisplayNamePrice.cs index d8db5db6..a4fb9600 100644 --- a/src/Orb/Models/NewPlanMatrixWithDisplayNamePrice.cs +++ b/src/Orb/Models/NewPlanMatrixWithDisplayNamePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanMatrixWithDisplayNamePriceProperties = Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanMatrixWithDisplayNamePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanMatrixWithDisplayNamePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,26 +39,26 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MatrixWithDisplayNameConfig + public required Dictionary MatrixWithDisplayNameConfig { get { if ( !this.Properties.TryGetValue( "matrix_with_display_name_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -67,14 +66,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); } set { - this.Properties["matrix_with_display_name_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_display_name_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -82,17 +81,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanMatrixWithDisplayNamePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanMatrixWithDisplayNamePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanMatrixWithDisplayNamePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanMatrixWithDisplayNamePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/Cadence.cs b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/Cadence.cs index 09511979..d9ebe0c6 100644 --- a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs index 42005079..679b0390 100644 --- a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs index 678946e1..246eab95 100644 --- a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanMatrixWithDisplayNamePriceProperties = Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanMatrixWithDisplayNamePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanMatrixWithDisplayNamePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ModelType.cs b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ModelType.cs index ce34bb41..7ef52a03 100644 --- a/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanMatrixWithDisplayNamePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MatrixWithDisplayName = new("matrix_with_display_name"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix_with_display_name" => Value.MatrixWithDisplayName, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMaxGroupTieredPackagePrice.cs b/src/Orb/Models/NewPlanMaxGroupTieredPackagePrice.cs index de1d13b1..18e430a1 100644 --- a/src/Orb/Models/NewPlanMaxGroupTieredPackagePrice.cs +++ b/src/Orb/Models/NewPlanMaxGroupTieredPackagePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanMaxGroupTieredPackagePriceProperties = Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanMaxGroupTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanMaxGroupTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,26 +39,26 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MaxGroupTieredPackageConfig + public required Dictionary MaxGroupTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "max_group_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -67,14 +66,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); } set { - this.Properties["max_group_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["max_group_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -82,17 +81,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanMaxGroupTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanMaxGroupTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanMaxGroupTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanMaxGroupTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/Cadence.cs index a1cb0034..f83424e3 100644 --- a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs index 2e58ffe7..712e0850 100644 --- a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index 9d02726c..8469824f 100644 --- a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanMaxGroupTieredPackagePriceProperties = Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanMaxGroupTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanMaxGroupTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ModelType.cs index 760c05f8..bdbf18e6 100644 --- a/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanMaxGroupTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MaxGroupTieredPackage = new("max_group_tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "max_group_tiered_package" => Value.MaxGroupTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanPackagePrice.cs b/src/Orb/Models/NewPlanPackagePrice.cs index b2afb059..c2a02941 100644 --- a/src/Orb/Models/NewPlanPackagePrice.cs +++ b/src/Orb/Models/NewPlanPackagePrice.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanPackagePriceProperties = Orb.Models.NewPlanPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanPackagePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanPackagePrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -18,16 +17,16 @@ public sealed record class NewPlanPackagePrice : Orb::ModelBase, Orb::IFromRaw(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,33 +36,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,29 +71,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required PackageConfig PackageConfig { get { - if (!this.Properties.TryGetValue("package_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("package_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("package_config"); } - set { this.Properties["package_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["package_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -143,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -166,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -181,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -209,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -227,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -248,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -266,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -286,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -329,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -349,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -388,16 +360,14 @@ public override void Validate() public NewPlanPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanPackagePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanPackagePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewPlanPackagePriceProperties/Cadence.cs index 11fa4bba..3d0d8efe 100644 --- a/src/Orb/Models/NewPlanPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfig.cs index bc06220b..9fe5369c 100644 --- a/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfigVariants/All.cs index 61870215..94a1770c 100644 --- a/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanPackagePriceProperties = Orb.Models.NewPlanPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewPlanPackagePriceProperties/ModelType.cs index 2fff8865..53365c29 100644 --- a/src/Orb/Models/NewPlanPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Package = new("package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "package" => Value.Package, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanPackageWithAllocationPrice.cs b/src/Orb/Models/NewPlanPackageWithAllocationPrice.cs index 424168e4..6f753bcd 100644 --- a/src/Orb/Models/NewPlanPackageWithAllocationPrice.cs +++ b/src/Orb/Models/NewPlanPackageWithAllocationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanPackageWithAllocationPriceProperties = Orb.Models.NewPlanPackageWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanPackageWithAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanPackageWithAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanPackageWithAllocationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary PackageWithAllocationConfig + public required Dictionary PackageWithAllocationConfig { get { if ( !this.Properties.TryGetValue( "package_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -100,14 +99,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("package_with_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("package_with_allocation_config"); } set { - this.Properties["package_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["package_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanPackageWithAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanPackageWithAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanPackageWithAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanPackageWithAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/Cadence.cs index 70a3296f..508557d6 100644 --- a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackageWithAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfig.cs index c21a0d18..820c0c1c 100644 --- a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanPackageWithAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackageWithAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs index d47446e7..a549b34e 100644 --- a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanPackageWithAllocationPriceProperties = Orb.Models.NewPlanPackageWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackageWithAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanPackageWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanPackageWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ModelType.cs index 63052b48..6ff8ac82 100644 --- a/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanPackageWithAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanPackageWithAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType PackageWithAllocation = new("package_with_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "package_with_allocation" => Value.PackageWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPrice.cs b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPrice.cs index 61a62e57..26a417db 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPrice.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanScalableMatrixWithTieredPricingPriceProperties = Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanScalableMatrixWithTieredPricingPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewPlanScalableMatrixWithTieredPricingPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanScalableMatrixWithTieredPricingPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,26 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithTieredPricingConfig + public required Dictionary ScalableMatrixWithTieredPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_tiered_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -105,9 +99,7 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException( "scalable_matrix_with_tiered_pricing_config" ); @@ -115,7 +107,7 @@ public required string Name set { this.Properties["scalable_matrix_with_tiered_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -126,15 +118,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -145,15 +134,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -164,19 +150,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -187,12 +171,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -202,23 +186,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -230,12 +207,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -248,17 +225,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -269,15 +247,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -287,17 +262,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -307,17 +277,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -331,17 +296,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -350,16 +316,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -370,12 +336,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -412,17 +378,15 @@ public override void Validate() public NewPlanScalableMatrixWithTieredPricingPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanScalableMatrixWithTieredPricingPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewPlanScalableMatrixWithTieredPricingPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanScalableMatrixWithTieredPricingPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/Cadence.cs index de78a36e..e01d10b8 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs index 0accc1f3..288e1514 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs index 94d7c1ee..ce9e463e 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanScalableMatrixWithTieredPricingPriceProperties = Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanScalableMatrixWithTieredPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanScalableMatrixWithTieredPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ModelType.cs index 5d72e544..57fc34ad 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithTieredPricingPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ScalableMatrixWithTieredPricing = new( "scalable_matrix_with_tiered_pricing" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "scalable_matrix_with_tiered_pricing" => Value.ScalableMatrixWithTieredPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPrice.cs b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPrice.cs index 5b9e810e..2947338a 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPrice.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPrice.cs @@ -1,19 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanScalableMatrixWithUnitPricingPriceProperties = Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanScalableMatrixWithUnitPricingPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -22,17 +19,17 @@ public sealed record class NewPlanScalableMatrixWithUnitPricingPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanScalableMatrixWithUnitPricingPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,26 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithUnitPricingConfig + public required Dictionary ScalableMatrixWithUnitPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_unit_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -105,9 +99,7 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException( "scalable_matrix_with_unit_pricing_config" ); @@ -115,7 +107,7 @@ public required string Name set { this.Properties["scalable_matrix_with_unit_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -126,15 +118,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -145,15 +134,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -164,19 +150,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -187,12 +171,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -202,23 +186,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -230,12 +207,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -248,17 +225,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -269,15 +247,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -287,17 +262,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -307,17 +277,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -331,17 +296,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -350,16 +316,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -370,12 +336,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -412,17 +378,15 @@ public override void Validate() public NewPlanScalableMatrixWithUnitPricingPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanScalableMatrixWithUnitPricingPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewPlanScalableMatrixWithUnitPricingPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanScalableMatrixWithUnitPricingPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/Cadence.cs index 8f22b113..8a1809aa 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs index ba3f61b3..5f133028 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs index 8265913b..d9ebc664 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanScalableMatrixWithUnitPricingPriceProperties = Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanScalableMatrixWithUnitPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanScalableMatrixWithUnitPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ModelType.cs index 776032b3..e940cfff 100644 --- a/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanScalableMatrixWithUnitPricingPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanScalableMatrixWithUnitPricingPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ScalableMatrixWithUnitPricing = new( "scalable_matrix_with_unit_pricing" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "scalable_matrix_with_unit_pricing" => Value.ScalableMatrixWithUnitPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanThresholdTotalAmountPrice.cs b/src/Orb/Models/NewPlanThresholdTotalAmountPrice.cs index 641fd83a..43076acf 100644 --- a/src/Orb/Models/NewPlanThresholdTotalAmountPrice.cs +++ b/src/Orb/Models/NewPlanThresholdTotalAmountPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanThresholdTotalAmountPriceProperties = Orb.Models.NewPlanThresholdTotalAmountPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanThresholdTotalAmountPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanThresholdTotalAmountPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanThresholdTotalAmountPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary ThresholdTotalAmountConfig + public required Dictionary ThresholdTotalAmountConfig { get { if ( !this.Properties.TryGetValue( "threshold_total_amount_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -100,14 +99,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("threshold_total_amount_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("threshold_total_amount_config"); } set { - this.Properties["threshold_total_amount_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["threshold_total_amount_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanThresholdTotalAmountPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanThresholdTotalAmountPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanThresholdTotalAmountPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanThresholdTotalAmountPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/Cadence.cs index 71f695bf..2773cb72 100644 --- a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanThresholdTotalAmountPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfig.cs index 0cbd035e..85a50915 100644 --- a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanThresholdTotalAmountPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanThresholdTotalAmountPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs index fcb2044b..4799e207 100644 --- a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanThresholdTotalAmountPriceProperties = Orb.Models.NewPlanThresholdTotalAmountPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanThresholdTotalAmountPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanThresholdTotalAmountPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanThresholdTotalAmountPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ModelType.cs index 9e24c317..5620c327 100644 --- a/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanThresholdTotalAmountPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanThresholdTotalAmountPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ThresholdTotalAmount = new("threshold_total_amount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "threshold_total_amount" => Value.ThresholdTotalAmount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTierWithProrationPrice.cs b/src/Orb/Models/NewPlanTierWithProrationPrice.cs index 3d3f69a0..3c5f45bc 100644 --- a/src/Orb/Models/NewPlanTierWithProrationPrice.cs +++ b/src/Orb/Models/NewPlanTierWithProrationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanTierWithProrationPriceProperties = Orb.Models.NewPlanTierWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanTierWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanTierWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanTierWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithProrationConfig + public required Dictionary TieredWithProrationConfig { get { if ( !this.Properties.TryGetValue( "tiered_with_proration_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -100,14 +99,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_with_proration_config"); } set { - this.Properties["tiered_with_proration_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["tiered_with_proration_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -118,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +133,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +149,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +206,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +224,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +276,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +295,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +315,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +377,15 @@ public override void Validate() public NewPlanTierWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanTierWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanTierWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanTierWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/Cadence.cs index c017a093..c9bad368 100644 --- a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTierWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfig.cs index d81309f3..0151c475 100644 --- a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanTierWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanTierWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index a7c3f85f..a4008841 100644 --- a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanTierWithProrationPriceProperties = Orb.Models.NewPlanTierWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTierWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanTierWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanTierWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ModelType.cs index b0dfb815..b5cd6d84 100644 --- a/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanTierWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTierWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredWithProration = new("tiered_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_with_proration" => Value.TieredWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredBPSPrice.cs b/src/Orb/Models/NewPlanTieredBPSPrice.cs index 6fb37135..f6d84c4b 100644 --- a/src/Orb/Models/NewPlanTieredBPSPrice.cs +++ b/src/Orb/Models/NewPlanTieredBPSPrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanTieredBPSPriceProperties = Orb.Models.NewPlanTieredBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanTieredBPSPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanTieredBPSPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +17,16 @@ public sealed record class NewPlanTieredBPSPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +36,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanTieredBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,32 +71,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required TieredBPSConfig TieredBPSConfig { get { - if (!this.Properties.TryGetValue("tiered_bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_bps_config"); } - set - { - this.Properties["tiered_bps_config"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["tiered_bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -111,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -130,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -149,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -172,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -187,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -215,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -233,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,16 +360,14 @@ public override void Validate() public NewPlanTieredBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanTieredBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanTieredBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanTieredBPSPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanTieredBPSPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanTieredBPSPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanTieredBPSPriceProperties/Cadence.cs index ad1a9b34..1c284601 100644 --- a/src/Orb/Models/NewPlanTieredBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanTieredBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfig.cs index d4f35159..acf2c462 100644 --- a/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanTieredBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs index 846930df..aabeb0f1 100644 --- a/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanTieredBPSPriceProperties = Orb.Models.NewPlanTieredBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanTieredBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanTieredBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanTieredBPSPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanTieredBPSPriceProperties/ModelType.cs index 8ffc8d46..ac0b3706 100644 --- a/src/Orb/Models/NewPlanTieredBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanTieredBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredBPS = new("tiered_bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_bps" => Value.TieredBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredPackagePrice.cs b/src/Orb/Models/NewPlanTieredPackagePrice.cs index 80ce026f..b7bab205 100644 --- a/src/Orb/Models/NewPlanTieredPackagePrice.cs +++ b/src/Orb/Models/NewPlanTieredPackagePrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanTieredPackagePriceProperties = Orb.Models.NewPlanTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,16 @@ public sealed record class NewPlanTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +38,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanTieredPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,37 +74,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageConfig + public required Dictionary TieredPackageConfig { get { - if ( - !this.Properties.TryGetValue("tiered_package_config", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("tiered_package_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_config"); - } - set - { - this.Properties["tiered_package_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_package_config"); } + set { this.Properties["tiered_package_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,15 +106,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,15 +122,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,19 +138,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -177,12 +159,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -192,23 +174,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -220,12 +195,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -238,17 +213,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -259,15 +235,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -277,17 +250,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -297,17 +265,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -321,17 +284,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -340,16 +304,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -360,12 +324,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -402,15 +366,15 @@ public override void Validate() public NewPlanTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/NewPlanTieredPackagePriceProperties/Cadence.cs index 0e5ed8cc..ac2664e9 100644 --- a/src/Orb/Models/NewPlanTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfig.cs index f60a21bf..b30d6d15 100644 --- a/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index c6dad186..ccfda3fb 100644 --- a/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanTieredPackagePriceProperties = Orb.Models.NewPlanTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/NewPlanTieredPackagePriceProperties/ModelType.cs index dfde746d..49319890 100644 --- a/src/Orb/Models/NewPlanTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredPackage = new("tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_package" => Value.TieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredPackageWithMinimumPrice.cs b/src/Orb/Models/NewPlanTieredPackageWithMinimumPrice.cs index 2a107d58..4e95583f 100644 --- a/src/Orb/Models/NewPlanTieredPackageWithMinimumPrice.cs +++ b/src/Orb/Models/NewPlanTieredPackageWithMinimumPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanTieredPackageWithMinimumPriceProperties = Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanTieredPackageWithMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanTieredPackageWithMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanTieredPackageWithMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageWithMinimumConfig + public required Dictionary TieredPackageWithMinimumConfig { get { if ( !this.Properties.TryGetValue( "tiered_package_with_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -100,14 +99,13 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); } set { this.Properties["tiered_package_with_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -118,15 +116,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,15 +132,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,19 +148,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -179,12 +169,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,23 +184,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -222,12 +205,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -240,17 +223,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,15 +245,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -279,17 +260,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -299,17 +275,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -323,17 +294,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -342,16 +314,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -362,12 +334,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -404,15 +376,15 @@ public override void Validate() public NewPlanTieredPackageWithMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanTieredPackageWithMinimumPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanTieredPackageWithMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanTieredPackageWithMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/Cadence.cs index 8c5bc461..9491c04d 100644 --- a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs index b6423460..4db43dda 100644 --- a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 50f8b2b2..54b0bb14 100644 --- a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanTieredPackageWithMinimumPriceProperties = Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanTieredPackageWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanTieredPackageWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ModelType.cs index f374c84d..20b65348 100644 --- a/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanTieredPackageWithMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPackageWithMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredPackageWithMinimum = new("tiered_package_with_minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_package_with_minimum" => Value.TieredPackageWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredPrice.cs b/src/Orb/Models/NewPlanTieredPrice.cs index 9c19aa21..b65b8336 100644 --- a/src/Orb/Models/NewPlanTieredPrice.cs +++ b/src/Orb/Models/NewPlanTieredPrice.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanTieredPriceProperties = Orb.Models.NewPlanTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanTieredPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanTieredPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -18,16 +17,16 @@ public sealed record class NewPlanTieredPrice : Orb::ModelBase, Orb::IFromRaw(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,33 +36,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanTieredPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -73,29 +71,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required TieredConfig TieredConfig { get { - if (!this.Properties.TryGetValue("tiered_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_config"); } - set { this.Properties["tiered_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiered_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -143,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -166,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -181,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -209,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -227,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -248,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -266,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -286,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -329,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -349,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -388,16 +360,14 @@ public override void Validate() public NewPlanTieredPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanTieredPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanTieredPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanTieredPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanTieredPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanTieredPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanTieredPriceProperties/Cadence.cs index 31aa3b7f..65355779 100644 --- a/src/Orb/Models/NewPlanTieredPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanTieredPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfig.cs index 1ca013e2..9554b95f 100644 --- a/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanTieredPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfigVariants/All.cs index 838b1c41..0b32fb13 100644 --- a/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanTieredPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanTieredPriceProperties = Orb.Models.NewPlanTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanTieredPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanTieredPriceProperties/ModelType.cs index 9571bf49..e7fad2c4 100644 --- a/src/Orb/Models/NewPlanTieredPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanTieredPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Tiered = new("tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered" => Value.Tiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredWithMinimumPrice.cs b/src/Orb/Models/NewPlanTieredWithMinimumPrice.cs index 6d3dce7f..1739f972 100644 --- a/src/Orb/Models/NewPlanTieredWithMinimumPrice.cs +++ b/src/Orb/Models/NewPlanTieredWithMinimumPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanTieredWithMinimumPriceProperties = Orb.Models.NewPlanTieredWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanTieredWithMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanTieredWithMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanTieredWithMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,37 +75,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithMinimumConfig + public required Dictionary TieredWithMinimumConfig { get { - if ( - !this.Properties.TryGetValue( - "tiered_with_minimum_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("tiered_with_minimum_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_with_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); } set { - this.Properties["tiered_with_minimum_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["tiered_with_minimum_config"] = JsonSerializer.SerializeToElement( value ); } @@ -119,15 +112,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +128,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,19 +144,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +165,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +180,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,12 +201,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -241,17 +219,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +241,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +256,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +271,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +290,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +310,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +330,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +372,15 @@ public override void Validate() public NewPlanTieredWithMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanTieredWithMinimumPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanTieredWithMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanTieredWithMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/Cadence.cs index 4f4fc11b..38d42ef7 100644 --- a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredWithMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfig.cs index 340fd99a..3a3368a9 100644 --- a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanTieredWithMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredWithMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 27ae9976..5fcede8a 100644 --- a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanTieredWithMinimumPriceProperties = Orb.Models.NewPlanTieredWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredWithMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanTieredWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanTieredWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ModelType.cs index eb6b359f..3498e842 100644 --- a/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanTieredWithMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanTieredWithMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredWithMinimum = new("tiered_with_minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_with_minimum" => Value.TieredWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanUnitPrice.cs b/src/Orb/Models/NewPlanUnitPrice.cs index 613f29d5..f90d41cf 100644 --- a/src/Orb/Models/NewPlanUnitPrice.cs +++ b/src/Orb/Models/NewPlanUnitPrice.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanUnitPriceProperties = Orb.Models.NewPlanUnitPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewPlanUnitPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewPlanUnitPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -18,16 +17,16 @@ public sealed record class NewPlanUnitPrice : Orb::ModelBase, Orb::IFromRaw(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,32 +36,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanUnitPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -72,29 +71,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required UnitConfig UnitConfig { get { - if (!this.Properties.TryGetValue("unit_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_config"); } - set { this.Properties["unit_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,15 +103,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -123,15 +119,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -142,19 +135,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -165,12 +156,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -180,23 +171,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -208,12 +192,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -226,17 +210,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -247,15 +232,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -265,17 +247,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -285,17 +262,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -309,17 +281,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -328,16 +301,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -348,12 +321,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -387,16 +360,14 @@ public override void Validate() public NewPlanUnitPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanUnitPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanUnitPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewPlanUnitPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewPlanUnitPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewPlanUnitPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanUnitPriceProperties/Cadence.cs index ef417ab8..593e4c46 100644 --- a/src/Orb/Models/NewPlanUnitPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanUnitPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfig.cs index 06aafcd5..90025d5c 100644 --- a/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanUnitPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfigVariants/All.cs index acf78ef6..c967918e 100644 --- a/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanUnitPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanUnitPriceProperties = Orb.Models.NewPlanUnitPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanUnitPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanUnitPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanUnitPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanUnitPriceProperties/ModelType.cs index 1a1d0727..1f1b512b 100644 --- a/src/Orb/Models/NewPlanUnitPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanUnitPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Unit = new("unit"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit" => Value.Unit, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanUnitWithPercentPrice.cs b/src/Orb/Models/NewPlanUnitWithPercentPrice.cs index 60a55dac..99ae3ed0 100644 --- a/src/Orb/Models/NewPlanUnitWithPercentPrice.cs +++ b/src/Orb/Models/NewPlanUnitWithPercentPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanUnitWithPercentPriceProperties = Orb.Models.NewPlanUnitWithPercentPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanUnitWithPercentPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanUnitWithPercentPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanUnitWithPercentPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,39 +75,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithPercentConfig + public required Dictionary UnitWithPercentConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_percent_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("unit_with_percent_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_with_percent_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_percent_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("unit_with_percent_config"); } set { - this.Properties["unit_with_percent_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["unit_with_percent_config"] = JsonSerializer.SerializeToElement(value); } } @@ -119,15 +110,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +126,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,19 +142,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +163,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +178,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,12 +199,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -241,17 +217,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +239,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +254,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +269,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +288,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +308,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +328,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +370,15 @@ public override void Validate() public NewPlanUnitWithPercentPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanUnitWithPercentPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanUnitWithPercentPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanUnitWithPercentPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/Cadence.cs index 3843d43b..c607ec23 100644 --- a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithPercentPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfig.cs index 6f493364..882bbf55 100644 --- a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanUnitWithPercentPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithPercentPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs index 4acfedca..d56efdf6 100644 --- a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanUnitWithPercentPriceProperties = Orb.Models.NewPlanUnitWithPercentPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithPercentPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanUnitWithPercentPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanUnitWithPercentPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ModelType.cs index d21466f2..bbf99076 100644 --- a/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanUnitWithPercentPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithPercentPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType UnitWithPercent = new("unit_with_percent"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit_with_percent" => Value.UnitWithPercent, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanUnitWithProrationPrice.cs b/src/Orb/Models/NewPlanUnitWithProrationPrice.cs index c22f8729..fe87a5bf 100644 --- a/src/Orb/Models/NewPlanUnitWithProrationPrice.cs +++ b/src/Orb/Models/NewPlanUnitWithProrationPrice.cs @@ -1,17 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewPlanUnitWithProrationPriceProperties = Orb.Models.NewPlanUnitWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewPlanUnitWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -20,17 +19,17 @@ public sealed record class NewPlanUnitWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewPlanUnitWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -76,37 +75,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithProrationConfig + public required Dictionary UnitWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_proration_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("unit_with_proration_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("unit_with_proration_config"); } set { - this.Properties["unit_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["unit_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -119,15 +112,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,15 +128,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -157,19 +144,17 @@ public NewBillingCycleConfiguration? BillingCycleConfiguration get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +165,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +180,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,12 +201,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -241,17 +219,18 @@ public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +241,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +256,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,17 +271,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -324,17 +290,18 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +310,16 @@ public NewBillingCycleConfiguration? InvoicingCycleConfiguration /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +330,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +372,15 @@ public override void Validate() public NewPlanUnitWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewPlanUnitWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewPlanUnitWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewPlanUnitWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/Cadence.cs index 675264e1..b5568b05 100644 --- a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfig.cs index d68d3453..6eec4b1f 100644 --- a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.NewPlanUnitWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 8bc58613..63ee8afd 100644 --- a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewPlanUnitWithProrationPriceProperties = Orb.Models.NewPlanUnitWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewPlanUnitWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewPlanUnitWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ModelType.cs index 7e150beb..8d2dc66e 100644 --- a/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/NewPlanUnitWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewPlanUnitWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType UnitWithProration = new("unit_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit_with_proration" => Value.UnitWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewUsageDiscount.cs b/src/Orb/Models/NewUsageDiscount.cs index 2e50d252..5544f743 100644 --- a/src/Orb/Models/NewUsageDiscount.cs +++ b/src/Orb/Models/NewUsageDiscount.cs @@ -1,46 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewUsageDiscountProperties = Orb.Models.NewUsageDiscountProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewUsageDiscount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewUsageDiscount : ModelBase, IFromRaw { public required NewUsageDiscountProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("adjustment_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } public required double UsageDiscount { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -50,52 +48,42 @@ public required double UsageDiscount { get { - if (!this.Properties.TryGetValue("applies_to_all", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_all", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applies_to_all"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applies_to_all"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of item IDs to which this adjustment applies. /// - public Generic::List? AppliesToItemIDs + public List? AppliesToItemIDs { get { - if (!this.Properties.TryGetValue("applies_to_item_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_item_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_item_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_item_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The set of price IDs to which this adjustment applies. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,27 +93,27 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of filters that determine which prices this adjustment will apply to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,15 +124,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,14 +139,12 @@ public bool? IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -189,16 +172,14 @@ public override void Validate() public NewUsageDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewUsageDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + NewUsageDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static NewUsageDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static NewUsageDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/NewUsageDiscountProperties/AdjustmentType.cs b/src/Orb/Models/NewUsageDiscountProperties/AdjustmentType.cs index 844ba144..5701d3fe 100644 --- a/src/Orb/Models/NewUsageDiscountProperties/AdjustmentType.cs +++ b/src/Orb/Models/NewUsageDiscountProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewUsageDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType UsageDiscount = new("usage_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "usage_discount" => Value.UsageDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/NewUsageDiscountProperties/AppliesToAll.cs b/src/Orb/Models/NewUsageDiscountProperties/AppliesToAll.cs index 3ac4d103..8916123f 100644 --- a/src/Orb/Models/NewUsageDiscountProperties/AppliesToAll.cs +++ b/src/Orb/Models/NewUsageDiscountProperties/AppliesToAll.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewUsageDiscountProperties; /// /// If set, the adjustment will apply to every price on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AppliesToAll(bool value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AppliesToAll(bool value) : IEnum { public static readonly AppliesToAll True = new(true); @@ -23,7 +22,7 @@ public Value Known() => _value switch { true => Value.True, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public bool Raw() diff --git a/src/Orb/Models/NewUsageDiscountProperties/PriceType.cs b/src/Orb/Models/NewUsageDiscountProperties/PriceType.cs index 0f68f3a0..d9c651f6 100644 --- a/src/Orb/Models/NewUsageDiscountProperties/PriceType.cs +++ b/src/Orb/Models/NewUsageDiscountProperties/PriceType.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.NewUsageDiscountProperties; /// /// If set, only prices of the specified type will have the adjustment applied. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType Usage = new("usage"); @@ -39,7 +38,7 @@ public Value Known() => "fixed_in_arrears" => Value.FixedInArrears, "fixed" => Value.Fixed, "in_arrears" => Value.InArrears, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/OtherSubLineItem.cs b/src/Orb/Models/OtherSubLineItem.cs index 2be92aa6..9a07b749 100644 --- a/src/Orb/Models/OtherSubLineItem.cs +++ b/src/Orb/Models/OtherSubLineItem.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using OtherSubLineItemProperties = Orb.Models.OtherSubLineItemProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class OtherSubLineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class OtherSubLineItem : ModelBase, IFromRaw { /// /// The total amount for this sub line item. @@ -18,72 +17,72 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required SubLineItemGrouping? Grouping { get { - if (!this.Properties.TryGetValue("grouping", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouping", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["grouping"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public required OtherSubLineItemProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -98,16 +97,14 @@ public override void Validate() public OtherSubLineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - OtherSubLineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + OtherSubLineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static OtherSubLineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static OtherSubLineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/OtherSubLineItemProperties/Type.cs b/src/Orb/Models/OtherSubLineItemProperties/Type.cs index c779c5ca..6a1503bb 100644 --- a/src/Orb/Models/OtherSubLineItemProperties/Type.cs +++ b/src/Orb/Models/OtherSubLineItemProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.OtherSubLineItemProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Null = new("'null'"); diff --git a/src/Orb/Models/PackageConfig.cs b/src/Orb/Models/PackageConfig.cs index 2dc191bf..59d1ecdd 100644 --- a/src/Orb/Models/PackageConfig.cs +++ b/src/Orb/Models/PackageConfig.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PackageConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PackageConfig : ModelBase, IFromRaw { /// /// A currency amount to rate usage by @@ -17,16 +16,16 @@ public required string PackageAmount { get { - if (!this.Properties.TryGetValue("package_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("package_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "package_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("package_amount"); } - set { this.Properties["package_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["package_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +36,15 @@ public required long PackageSize { get { - if (!this.Properties.TryGetValue("package_size", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("package_size", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "package_size", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["package_size"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["package_size"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +56,14 @@ public override void Validate() public PackageConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PackageConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + PackageConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PackageConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static PackageConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PaginationMetadata.cs b/src/Orb/Models/PaginationMetadata.cs index 9c77c7b1..64f9f709 100644 --- a/src/Orb/Models/PaginationMetadata.cs +++ b/src/Orb/Models/PaginationMetadata.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PaginationMetadata : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PaginationMetadata : ModelBase, IFromRaw { public required bool HasMore { get { - if (!this.Properties.TryGetValue("has_more", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("has_more", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "has_more", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["has_more"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["has_more"] = JsonSerializer.SerializeToElement(value); } } public required string? NextCursor { get { - if (!this.Properties.TryGetValue("next_cursor", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("next_cursor", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "next_cursor", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["next_cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["next_cursor"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -49,16 +48,14 @@ public override void Validate() public PaginationMetadata() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PaginationMetadata(Generic::Dictionary properties) + [SetsRequiredMembers] + PaginationMetadata(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PaginationMetadata FromRawUnchecked( - Generic::Dictionary properties - ) + public static PaginationMetadata FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PerPriceCost.cs b/src/Orb/Models/PerPriceCost.cs index 0a0dd775..17bd0f56 100644 --- a/src/Orb/Models/PerPriceCost.cs +++ b/src/Orb/Models/PerPriceCost.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PerPriceCost : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PerPriceCost : ModelBase, IFromRaw { /// /// The price object @@ -17,13 +16,13 @@ public required Price Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) throw new System::ArgumentOutOfRangeException("price", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price"); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -33,16 +32,16 @@ public required string PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price_id"); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -52,16 +51,16 @@ public required string Subtotal { get { - if (!this.Properties.TryGetValue("subtotal", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("subtotal", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "subtotal", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("subtotal"); } - set { this.Properties["subtotal"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,13 +70,13 @@ public required string Total { get { - if (!this.Properties.TryGetValue("total", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("total", out JsonElement element)) throw new System::ArgumentOutOfRangeException("total", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("total"); } - set { this.Properties["total"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); } } /// @@ -87,12 +86,12 @@ public double? Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -107,16 +106,14 @@ public override void Validate() public PerPriceCost() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PerPriceCost(Generic::Dictionary properties) + [SetsRequiredMembers] + PerPriceCost(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PerPriceCost FromRawUnchecked( - Generic::Dictionary properties - ) + public static PerPriceCost FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PercentageDiscount.cs b/src/Orb/Models/PercentageDiscount.cs index dec2531e..7703f3fd 100644 --- a/src/Orb/Models/PercentageDiscount.cs +++ b/src/Orb/Models/PercentageDiscount.cs @@ -1,31 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PercentageDiscountProperties = Orb.Models.PercentageDiscountProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PercentageDiscount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PercentageDiscount : ModelBase, IFromRaw { public required PercentageDiscountProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,66 +34,58 @@ public required double PercentageDiscount1 { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } /// /// List of price_ids that this discount applies to. For plan/plan phase discounts, /// this can be a subset of prices. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this discount to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -116,16 +106,14 @@ public override void Validate() public PercentageDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PercentageDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + PercentageDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PercentageDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static PercentageDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PercentageDiscountInterval.cs b/src/Orb/Models/PercentageDiscountInterval.cs index 1b338095..0d87ce1d 100644 --- a/src/Orb/Models/PercentageDiscountInterval.cs +++ b/src/Orb/Models/PercentageDiscountInterval.cs @@ -1,29 +1,28 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PercentageDiscountIntervalProperties = Orb.Models.PercentageDiscountIntervalProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PercentageDiscountInterval - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The price interval ids that this discount interval applies to. /// - public required Generic::List AppliesToPriceIntervalIDs + public required List AppliesToPriceIntervalIDs { get { if ( !this.Properties.TryGetValue( "applies_to_price_interval_ids", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -31,13 +30,14 @@ public sealed record class PercentageDiscountInterval "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_interval_ids"); } set { - this.Properties["applies_to_price_interval_ids"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -45,17 +45,17 @@ public sealed record class PercentageDiscountInterval { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -65,34 +65,34 @@ public sealed record class PercentageDiscountInterval { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices this discount interval applies to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,18 +103,15 @@ public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -124,15 +121,15 @@ public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -154,15 +151,15 @@ public override void Validate() public PercentageDiscountInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PercentageDiscountInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + PercentageDiscountInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PercentageDiscountInterval FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PercentageDiscountIntervalProperties/DiscountType.cs b/src/Orb/Models/PercentageDiscountIntervalProperties/DiscountType.cs index 190260a7..28937547 100644 --- a/src/Orb/Models/PercentageDiscountIntervalProperties/DiscountType.cs +++ b/src/Orb/Models/PercentageDiscountIntervalProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PercentageDiscountIntervalProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Percentage = new("percentage"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage" => Value.Percentage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PercentageDiscountProperties/DiscountType.cs b/src/Orb/Models/PercentageDiscountProperties/DiscountType.cs index 0e16ce51..6617fba6 100644 --- a/src/Orb/Models/PercentageDiscountProperties/DiscountType.cs +++ b/src/Orb/Models/PercentageDiscountProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PercentageDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Percentage = new("percentage"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage" => Value.Percentage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PlanPhaseAmountDiscountAdjustment.cs b/src/Orb/Models/PlanPhaseAmountDiscountAdjustment.cs index 52cb900d..8145e0bf 100644 --- a/src/Orb/Models/PlanPhaseAmountDiscountAdjustment.cs +++ b/src/Orb/Models/PlanPhaseAmountDiscountAdjustment.cs @@ -1,46 +1,45 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanPhaseAmountDiscountAdjustmentProperties = Orb.Models.PlanPhaseAmountDiscountAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PlanPhaseAmountDiscountAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required PlanPhaseAmountDiscountAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -51,59 +50,54 @@ public required string AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount_discount"); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -114,18 +108,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,18 +126,15 @@ public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +144,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,24 +163,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -218,15 +199,15 @@ public override void Validate() public PlanPhaseAmountDiscountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhaseAmountDiscountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhaseAmountDiscountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PlanPhaseAmountDiscountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PlanPhaseAmountDiscountAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/PlanPhaseAmountDiscountAdjustmentProperties/AdjustmentType.cs index 8bc3a73d..597f5b1f 100644 --- a/src/Orb/Models/PlanPhaseAmountDiscountAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/PlanPhaseAmountDiscountAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PlanPhaseAmountDiscountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType AmountDiscount = new("amount_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "amount_discount" => Value.AmountDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PlanPhaseMaximumAdjustment.cs b/src/Orb/Models/PlanPhaseMaximumAdjustment.cs index 27c037c3..4558830f 100644 --- a/src/Orb/Models/PlanPhaseMaximumAdjustment.cs +++ b/src/Orb/Models/PlanPhaseMaximumAdjustment.cs @@ -1,89 +1,83 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanPhaseMaximumAdjustmentProperties = Orb.Models.PlanPhaseMaximumAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PlanPhaseMaximumAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required PlanPhaseMaximumAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,18 +88,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,16 +107,16 @@ public required string MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("maximum_amount"); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,18 +126,15 @@ public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -156,15 +144,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,24 +163,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -218,15 +199,15 @@ public override void Validate() public PlanPhaseMaximumAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhaseMaximumAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhaseMaximumAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PlanPhaseMaximumAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PlanPhaseMaximumAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/PlanPhaseMaximumAdjustmentProperties/AdjustmentType.cs index 176b4fdd..00561a3f 100644 --- a/src/Orb/Models/PlanPhaseMaximumAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/PlanPhaseMaximumAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PlanPhaseMaximumAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType Maximum = new("maximum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "maximum" => Value.Maximum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PlanPhaseMinimumAdjustment.cs b/src/Orb/Models/PlanPhaseMinimumAdjustment.cs index d0f7b63f..440d1c7e 100644 --- a/src/Orb/Models/PlanPhaseMinimumAdjustment.cs +++ b/src/Orb/Models/PlanPhaseMinimumAdjustment.cs @@ -1,89 +1,83 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanPhaseMinimumAdjustmentProperties = Orb.Models.PlanPhaseMinimumAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PlanPhaseMinimumAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required PlanPhaseMinimumAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,18 +88,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -115,16 +106,16 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -135,16 +126,16 @@ public required string MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("minimum_amount"); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,18 +145,15 @@ public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -175,15 +163,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -194,24 +182,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -238,15 +219,15 @@ public override void Validate() public PlanPhaseMinimumAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhaseMinimumAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhaseMinimumAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PlanPhaseMinimumAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PlanPhaseMinimumAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/PlanPhaseMinimumAdjustmentProperties/AdjustmentType.cs index 9cf4a9a9..6dbac7ea 100644 --- a/src/Orb/Models/PlanPhaseMinimumAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/PlanPhaseMinimumAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PlanPhaseMinimumAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType Minimum = new("minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "minimum" => Value.Minimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PlanPhasePercentageDiscountAdjustment.cs b/src/Orb/Models/PlanPhasePercentageDiscountAdjustment.cs index fada7391..006cb7f9 100644 --- a/src/Orb/Models/PlanPhasePercentageDiscountAdjustment.cs +++ b/src/Orb/Models/PlanPhasePercentageDiscountAdjustment.cs @@ -1,89 +1,83 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanPhasePercentageDiscountAdjustmentProperties = Orb.Models.PlanPhasePercentageDiscountAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PlanPhasePercentageDiscountAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required PlanPhasePercentageDiscountAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,18 +88,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,18 +107,15 @@ public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -137,18 +125,15 @@ public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -158,15 +143,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -177,24 +162,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -220,15 +198,15 @@ public override void Validate() public PlanPhasePercentageDiscountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhasePercentageDiscountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhasePercentageDiscountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PlanPhasePercentageDiscountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PlanPhasePercentageDiscountAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/PlanPhasePercentageDiscountAdjustmentProperties/AdjustmentType.cs index 288d66ae..1084e4f5 100644 --- a/src/Orb/Models/PlanPhasePercentageDiscountAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/PlanPhasePercentageDiscountAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PlanPhasePercentageDiscountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType PercentageDiscount = new("percentage_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "percentage_discount" => Value.PercentageDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PlanPhaseUsageDiscountAdjustment.cs b/src/Orb/Models/PlanPhaseUsageDiscountAdjustment.cs index 45fd3b1d..1401ff56 100644 --- a/src/Orb/Models/PlanPhaseUsageDiscountAdjustment.cs +++ b/src/Orb/Models/PlanPhaseUsageDiscountAdjustment.cs @@ -1,89 +1,83 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanPhaseUsageDiscountAdjustmentProperties = Orb.Models.PlanPhaseUsageDiscountAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PlanPhaseUsageDiscountAdjustment - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required PlanPhaseUsageDiscountAdjustmentProperties::AdjustmentType AdjustmentType { get { - if (!this.Properties.TryGetValue("adjustment_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("adjustment_type"); } - set { this.Properties["adjustment_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_type"] = JsonSerializer.SerializeToElement(value); } } /// /// The price IDs that this adjustment applies to. /// - public required Generic::List AppliesToPriceIDs + public required List AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "applies_to_price_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_ids"); } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this adjustment to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -94,18 +88,15 @@ public required bool IsInvoiceLevel { get { - if (!this.Properties.TryGetValue("is_invoice_level", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("is_invoice_level", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "is_invoice_level", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["is_invoice_level"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["is_invoice_level"] = JsonSerializer.SerializeToElement(value); } } /// @@ -115,18 +106,15 @@ public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,15 +124,15 @@ public required string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "reason", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -155,24 +143,17 @@ public required string? ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -184,15 +165,15 @@ public required double UsageDiscount { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -217,15 +198,15 @@ public override void Validate() public PlanPhaseUsageDiscountAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhaseUsageDiscountAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhaseUsageDiscountAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PlanPhaseUsageDiscountAdjustment FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PlanPhaseUsageDiscountAdjustmentProperties/AdjustmentType.cs b/src/Orb/Models/PlanPhaseUsageDiscountAdjustmentProperties/AdjustmentType.cs index 2b99063b..491433c3 100644 --- a/src/Orb/Models/PlanPhaseUsageDiscountAdjustmentProperties/AdjustmentType.cs +++ b/src/Orb/Models/PlanPhaseUsageDiscountAdjustmentProperties/AdjustmentType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PlanPhaseUsageDiscountAdjustmentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class AdjustmentType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class AdjustmentType(string value) : IEnum { public static readonly AdjustmentType UsageDiscount = new("usage_discount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "usage_discount" => Value.UsageDiscount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDFetchParams.cs b/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDFetchParams.cs index 0d309f60..965615a6 100644 --- a/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDFetchParams.cs +++ b/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDFetchParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Plans.ExternalPlanID; @@ -20,13 +19,13 @@ namespace Orb.Models.Plans.ExternalPlanID; /// that is present. A detailed explanation of price types can be found in the [Price /// schema](/core-concepts#plan-and-price). " /// -public sealed record class ExternalPlanIDFetchParams : Orb::ParamsBase +public sealed record class ExternalPlanIDFetchParams : ParamsBase { public required string ExternalPlanID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/external_plan_id/{0}", this.ExternalPlanID) ) @@ -35,12 +34,12 @@ public sealed record class ExternalPlanIDFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDUpdateParams.cs b/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDUpdateParams.cs index 9efafbb4..70ea0ede 100644 --- a/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDUpdateParams.cs +++ b/src/Orb/Models/Plans/ExternalPlanID/ExternalPlanIDUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Plans.ExternalPlanID; @@ -13,9 +12,9 @@ namespace Orb.Models.Plans.ExternalPlanID; /// /// Other fields on a plan are currently immutable. /// -public sealed record class ExternalPlanIDUpdateParams : Orb::ParamsBase +public sealed record class ExternalPlanIDUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string OtherExternalPlanID; @@ -28,17 +27,12 @@ public string? ExternalPlanID { get { - if (!this.BodyProperties.TryGetValue("external_plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("external_plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["external_plan_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -46,21 +40,21 @@ public string? ExternalPlanID /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/external_plan_id/{0}", this.OtherExternalPlanID) ) @@ -69,21 +63,21 @@ public string? ExternalPlanID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Plans/Plan.cs b/src/Orb/Models/Plans/Plan.cs index 6942de5b..ea8a1985 100644 --- a/src/Orb/Models/Plans/Plan.cs +++ b/src/Orb/Models/Plans/Plan.cs @@ -1,11 +1,10 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; using PlanProperties = Orb.Models.Plans.PlanProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Plans; @@ -14,56 +13,49 @@ namespace Orb.Models.Plans; /// be subscribed to by a customer. Plans define the billing behavior of the subscription. /// You can see more about how to configure prices in the [Price resource](/reference/price). /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Plan : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Plan : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// Adjustments for this plan. If the plan has phases, this includes adjustments /// across all phases of the plan. /// - public required Generic::List Adjustments + public required List Adjustments { get { - if (!this.Properties.TryGetValue("adjustments", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustments", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustments", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustments", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustments"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("adjustments"); } - set { this.Properties["adjustments"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustments"] = JsonSerializer.SerializeToElement(value); } } public required PlanProperties::BasePlan? BasePlan { get { - if (!this.Properties.TryGetValue("base_plan", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "base_plan", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("base_plan", out JsonElement element)) + throw new ArgumentOutOfRangeException("base_plan", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["base_plan"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["base_plan"] = JsonSerializer.SerializeToElement(value); } } /// @@ -74,30 +66,24 @@ public required string? BasePlanID { get { - if (!this.Properties.TryGetValue("base_plan_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "base_plan_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("base_plan_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("base_plan_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["base_plan_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["base_plan_id"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -107,16 +93,13 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -127,51 +110,40 @@ public required string? DefaultInvoiceMemo { get { - if (!this.Properties.TryGetValue("default_invoice_memo", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("default_invoice_memo", out JsonElement element)) + throw new ArgumentOutOfRangeException( "default_invoice_memo", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } public required string Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "description", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("description", out JsonElement element)) + throw new ArgumentOutOfRangeException("description", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("description"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("description"); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -183,18 +155,15 @@ public required string? ExternalPlanID { get { - if (!this.Properties.TryGetValue("external_plan_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_plan_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_plan_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_plan_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -205,49 +174,43 @@ public required string InvoicingCurrency { get { - if (!this.Properties.TryGetValue("invoicing_currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoicing_currency", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoicing_currency", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("invoicing_currency"); - } - set - { - this.Properties["invoicing_currency"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("invoicing_currency"); } + set { this.Properties["invoicing_currency"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -256,63 +219,57 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -325,115 +282,92 @@ public required long? NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "net_terms", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) + throw new ArgumentOutOfRangeException("net_terms", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List? PlanPhases + public required List? PlanPhases { get { - if (!this.Properties.TryGetValue("plan_phases", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "plan_phases", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("plan_phases", out JsonElement element)) + throw new ArgumentOutOfRangeException("plan_phases", "Missing required argument"); - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["plan_phases"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan_phases"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices for this plan. If the plan has phases, this includes prices across all /// phases of the plan. /// - public required Generic::List Prices + public required List Prices { get { - if (!this.Properties.TryGetValue("prices", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "prices", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("prices", out JsonElement element)) + throw new ArgumentOutOfRangeException("prices", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("prices"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("prices"); } - set { this.Properties["prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["prices"] = JsonSerializer.SerializeToElement(value); } } public required PlanProperties::Product Product { get { - if (!this.Properties.TryGetValue("product", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "product", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("product", out JsonElement element)) + throw new ArgumentOutOfRangeException("product", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("product"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("product"); } - set { this.Properties["product"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["product"] = JsonSerializer.SerializeToElement(value); } } public required PlanProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required PlanProperties::TrialConfig TrialConfig { get { - if (!this.Properties.TryGetValue("trial_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "trial_config", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("trial_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("trial_config", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("trial_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("trial_config"); } - set { this.Properties["trial_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["trial_config"] = JsonSerializer.SerializeToElement(value); } } public required long Version { get { - if (!this.Properties.TryGetValue("version", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "version", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("version", out JsonElement element)) + throw new ArgumentOutOfRangeException("version", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["version"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["version"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -479,14 +413,14 @@ public override void Validate() public Plan() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Plan(Generic::Dictionary properties) + [SetsRequiredMembers] + Plan(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Plan FromRawUnchecked(Generic::Dictionary properties) + public static Plan FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanCreateParams.cs b/src/Orb/Models/Plans/PlanCreateParams.cs index e275b301..ace746fc 100644 --- a/src/Orb/Models/Plans/PlanCreateParams.cs +++ b/src/Orb/Models/Plans/PlanCreateParams.cs @@ -1,19 +1,18 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using PlanCreateParamsProperties = Orb.Models.Plans.PlanCreateParamsProperties; -using System = System; -using Text = System.Text; namespace Orb.Models.Plans; /// /// This endpoint allows creation of plans including their prices. /// -public sealed record class PlanCreateParams : Orb::ParamsBase +public sealed record class PlanCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// An ISO 4217 currency string for invoices generated by subscriptions on this plan. @@ -22,68 +21,61 @@ public required string Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// /// Prices for this plan. If the plan has phases, this includes prices across all /// phases of the plan. /// - public required Generic::List Prices + public required List Prices { get { - if (!this.BodyProperties.TryGetValue("prices", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "prices", - "Missing required argument" - ); - - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("prices"); + if (!this.BodyProperties.TryGetValue("prices", out JsonElement element)) + throw new ArgumentOutOfRangeException("prices", "Missing required argument"); + + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("prices"); } - set { this.BodyProperties["prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Adjustments for this plan. If the plan has phases, this includes adjustments /// across all phases of the plan. /// - public Generic::List? Adjustments + public List? Adjustments { get { - if (!this.BodyProperties.TryGetValue("adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["adjustments"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["adjustments"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,21 +85,14 @@ public string? DefaultInvoiceMemo { get { - if ( - !this.BodyProperties.TryGetValue( - "default_invoice_memo", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("default_invoice_memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } @@ -115,17 +100,12 @@ public string? ExternalPlanID { get { - if (!this.BodyProperties.TryGetValue("external_plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("external_plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["external_plan_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -133,16 +113,16 @@ public string? ExternalPlanID /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,30 +134,30 @@ public long? NetTerms { get { - if (!this.BodyProperties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("net_terms", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// /// Configuration of pre-defined phases, each with their own prices and adjustments. /// Leave unspecified for plans with a single phase. /// - public Generic::List? PlanPhases + public List? PlanPhases { get { - if (!this.BodyProperties.TryGetValue("plan_phases", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("plan_phases", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["plan_phases"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["plan_phases"] = JsonSerializer.SerializeToElement(value); } } /// @@ -188,37 +168,37 @@ public long? NetTerms { get { - if (!this.BodyProperties.TryGetValue("status", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["status"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/plans") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/plans") { Query = this.QueryString(client), }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/Adjustment.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/Adjustment.cs index caaed4af..092a3737 100644 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/Adjustment.cs +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/Adjustment.cs @@ -1,33 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AdjustmentProperties = Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Plans.PlanCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Adjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Adjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the plan. /// - public required AdjustmentProperties::Adjustment Adjustment1 + public required AdjustmentProperties::Adjustment1 Adjustment1 { get { - if (!this.Properties.TryGetValue("adjustment", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustment", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustment", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustment", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +33,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +50,14 @@ public override void Validate() public Adjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Adjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + Adjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Adjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static Adjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/Adjustment.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/Adjustment.cs deleted file mode 100644 index 89aa6a52..00000000 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/Adjustment.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AdjustmentVariants = Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties; - -/// -/// The definition of a new adjustment to create and add to the plan. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Adjustment -{ - internal Adjustment() { } - - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); - - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); - - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); - - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); - - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/Adjustment1.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/Adjustment1.cs new file mode 100644 index 00000000..2851da55 --- /dev/null +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/Adjustment1.cs @@ -0,0 +1,30 @@ +using System.Text.Json.Serialization; +using AdjustmentVariants = Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties.AdjustmentVariants; + +namespace Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties; + +/// +/// The definition of a new adjustment to create and add to the plan. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Adjustment1 +{ + internal Adjustment1() { } + + public static implicit operator Adjustment1(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); + + public static implicit operator Adjustment1(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); + + public static implicit operator Adjustment1(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); + + public static implicit operator Adjustment1(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); + + public static implicit operator Adjustment1(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/AdjustmentVariants/All.cs index 32d4d4a6..b0b15c07 100644 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/AdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using AdjustmentProperties = Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanCreateParamsProperties.AdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : AdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment1, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : AdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment1, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : AdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment1, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : AdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment1, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : AdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment1, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhase.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhase.cs index c198cfe0..eccf85cc 100644 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhase.cs +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhase.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PlanPhaseProperties = Orb.Models.Plans.PlanCreateParamsProperties.PlanPhaseProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Plans.PlanCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PlanPhase : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PlanPhase : ModelBase, IFromRaw { /// /// Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. @@ -18,12 +17,12 @@ public required long Order { get { - if (!this.Properties.TryGetValue("order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("order", "Missing required argument"); + if (!this.Properties.TryGetValue("order", out JsonElement element)) + throw new ArgumentOutOfRangeException("order", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["order"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,17 +35,17 @@ public bool? AlignBillingWithPhaseStartDate if ( !this.Properties.TryGetValue( "align_billing_with_phase_start_date", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.Properties["align_billing_with_phase_start_date"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -58,24 +57,24 @@ public long? Duration { get { - if (!this.Properties.TryGetValue("duration", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration"] = JsonSerializer.SerializeToElement(value); } } public PlanPhaseProperties::DurationUnit? DurationUnit { get { - if (!this.Properties.TryGetValue("duration_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("duration_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -89,16 +88,14 @@ public override void Validate() public PlanPhase() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhase(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhase(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PlanPhase FromRawUnchecked( - Generic::Dictionary properties - ) + public static PlanPhase FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhaseProperties/DurationUnit.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhaseProperties/DurationUnit.cs index 33054270..5b638d56 100644 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhaseProperties/DurationUnit.cs +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/PlanPhaseProperties/DurationUnit.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanCreateParamsProperties.PlanPhaseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DurationUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DurationUnit(string value) : IEnum { public static readonly DurationUnit Daily = new("daily"); @@ -36,7 +35,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/Price.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/Price.cs deleted file mode 100644 index 55bad9a4..00000000 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/Price.cs +++ /dev/null @@ -1,86 +0,0 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using PriceProperties = Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Plans.PlanCreateParamsProperties; - -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Price : Orb::ModelBase, Orb::IFromRaw -{ - /// - /// The allocation price to add to the plan. - /// - public Models::NewAllocationPrice? AllocationPrice - { - get - { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) - return null; - - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); - } - } - - /// - /// The phase to add this price to. - /// - public long? PlanPhaseOrder - { - get - { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - return null; - - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); - } - } - - /// - /// The price to add to the plan - /// - public PriceProperties::Price? Price1 - { - get - { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) - return null; - - return Json::JsonSerializer.Deserialize(element); - } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } - } - - public override void Validate() - { - this.AllocationPrice?.Validate(); - _ = this.PlanPhaseOrder; - this.Price1?.Validate(); - } - - public Price() { } - -#pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Price(Generic::Dictionary properties) - { - Properties = properties; - } -#pragma warning restore CS8618 - - public static Price FromRawUnchecked(Generic::Dictionary properties) - { - return new(properties); - } -} diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/Price1.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/Price1.cs new file mode 100644 index 00000000..df50bfdc --- /dev/null +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/Price1.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; +using PriceProperties = Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties; + +namespace Orb.Models.Plans.PlanCreateParamsProperties; + +[JsonConverter(typeof(ModelConverter))] +public sealed record class Price1 : ModelBase, IFromRaw +{ + /// + /// The allocation price to add to the plan. + /// + public NewAllocationPrice? AllocationPrice + { + get + { + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) + return null; + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } + } + + /// + /// The phase to add this price to. + /// + public long? PlanPhaseOrder + { + get + { + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + return null; + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } + } + + /// + /// The price to add to the plan + /// + public PriceProperties::Price2? Price + { + get + { + if (!this.Properties.TryGetValue("price", out JsonElement element)) + return null; + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } + } + + public override void Validate() + { + this.AllocationPrice?.Validate(); + _ = this.PlanPhaseOrder; + this.Price?.Validate(); + } + + public Price1() { } + +#pragma warning disable CS8618 + [SetsRequiredMembers] + Price1(Dictionary properties) + { + Properties = properties; + } +#pragma warning restore CS8618 + + public static Price1 FromRawUnchecked(Dictionary properties) + { + return new(properties); + } +} diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/Price.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/Price.cs deleted file mode 100644 index d0f2f60b..00000000 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/Price.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties; - -/// -/// The price to add to the plan -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewPlanUnitPrice Create(Models::NewPlanUnitPrice value) => - new(value); - - public static PriceVariants::NewPlanPackagePrice Create(Models::NewPlanPackagePrice value) => - new(value); - - public static PriceVariants::NewPlanMatrixPrice Create(Models::NewPlanMatrixPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredPrice Create(Models::NewPlanTieredPrice value) => - new(value); - - public static PriceVariants::NewPlanTieredBPSPrice Create( - Models::NewPlanTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewPlanBPSPrice Create(Models::NewPlanBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkBPSPrice Create(Models::NewPlanBulkBPSPrice value) => - new(value); - - public static PriceVariants::NewPlanBulkPrice Create(Models::NewPlanBulkPrice value) => - new(value); - - public static PriceVariants::NewPlanThresholdTotalAmountPrice Create( - Models::NewPlanThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackagePrice Create( - Models::NewPlanTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredWithMinimumPrice Create( - Models::NewPlanTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithPercentPrice Create( - Models::NewPlanUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewPlanPackageWithAllocationPrice Create( - Models::NewPlanPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanTierWithProrationPrice Create( - Models::NewPlanTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanUnitWithProrationPrice Create( - Models::NewPlanUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedAllocationPrice Create( - Models::NewPlanGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithProratedMinimumPrice Create( - Models::NewPlanGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedWithMeteredMinimumPrice Create( - Models::NewPlanGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithDisplayNamePrice Create( - Models::NewPlanMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewPlanBulkWithProrationPrice Create( - Models::NewPlanBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPackagePrice Create( - Models::NewPlanGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanMaxGroupTieredPackagePrice Create( - Models::NewPlanMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithUnitPricingPrice Create( - Models::NewPlanScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanScalableMatrixWithTieredPricingPrice Create( - Models::NewPlanScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewPlanCumulativeGroupedBulkPrice Create( - Models::NewPlanCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewPlanTieredPackageWithMinimumPrice Create( - Models::NewPlanTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewPlanMatrixWithAllocationPrice Create( - Models::NewPlanMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewPlanGroupedTieredPrice Create( - Models::NewPlanGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/Price2.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/Price2.cs new file mode 100644 index 00000000..daa74380 --- /dev/null +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/Price2.cs @@ -0,0 +1,99 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties.PriceVariants; + +namespace Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties; + +/// +/// The price to add to the plan +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price2 +{ + internal Price2() { } + + public static implicit operator Price2(NewPlanUnitPrice value) => + new PriceVariants::NewPlanUnitPriceVariant(value); + + public static implicit operator Price2(NewPlanPackagePrice value) => + new PriceVariants::NewPlanPackagePriceVariant(value); + + public static implicit operator Price2(NewPlanMatrixPrice value) => + new PriceVariants::NewPlanMatrixPriceVariant(value); + + public static implicit operator Price2(NewPlanTieredPrice value) => + new PriceVariants::NewPlanTieredPriceVariant(value); + + public static implicit operator Price2(NewPlanTieredBPSPrice value) => + new PriceVariants::NewPlanTieredBPSPriceVariant(value); + + public static implicit operator Price2(NewPlanBPSPrice value) => + new PriceVariants::NewPlanBPSPriceVariant(value); + + public static implicit operator Price2(NewPlanBulkBPSPrice value) => + new PriceVariants::NewPlanBulkBPSPriceVariant(value); + + public static implicit operator Price2(NewPlanBulkPrice value) => + new PriceVariants::NewPlanBulkPriceVariant(value); + + public static implicit operator Price2(NewPlanThresholdTotalAmountPrice value) => + new PriceVariants::NewPlanThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price2(NewPlanTieredPackagePrice value) => + new PriceVariants::NewPlanTieredPackagePriceVariant(value); + + public static implicit operator Price2(NewPlanTieredWithMinimumPrice value) => + new PriceVariants::NewPlanTieredWithMinimumPriceVariant(value); + + public static implicit operator Price2(NewPlanUnitWithPercentPrice value) => + new PriceVariants::NewPlanUnitWithPercentPriceVariant(value); + + public static implicit operator Price2(NewPlanPackageWithAllocationPrice value) => + new PriceVariants::NewPlanPackageWithAllocationPriceVariant(value); + + public static implicit operator Price2(NewPlanTierWithProrationPrice value) => + new PriceVariants::NewPlanTierWithProrationPriceVariant(value); + + public static implicit operator Price2(NewPlanUnitWithProrationPrice value) => + new PriceVariants::NewPlanUnitWithProrationPriceVariant(value); + + public static implicit operator Price2(NewPlanGroupedAllocationPrice value) => + new PriceVariants::NewPlanGroupedAllocationPriceVariant(value); + + public static implicit operator Price2(NewPlanGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price2(NewPlanGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewPlanGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price2(NewPlanMatrixWithDisplayNamePrice value) => + new PriceVariants::NewPlanMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price2(NewPlanBulkWithProrationPrice value) => + new PriceVariants::NewPlanBulkWithProrationPriceVariant(value); + + public static implicit operator Price2(NewPlanGroupedTieredPackagePrice value) => + new PriceVariants::NewPlanGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price2(NewPlanMaxGroupTieredPackagePrice value) => + new PriceVariants::NewPlanMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price2(NewPlanScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price2(NewPlanScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewPlanScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price2(NewPlanCumulativeGroupedBulkPrice value) => + new PriceVariants::NewPlanCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price2(NewPlanTieredPackageWithMinimumPrice value) => + new PriceVariants::NewPlanTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price2(NewPlanMatrixWithAllocationPrice value) => + new PriceVariants::NewPlanMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price2(NewPlanGroupedTieredPrice value) => + new PriceVariants::NewPlanGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/PriceVariants/All.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/PriceVariants/All.cs index 670d536f..e5c0538a 100644 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/PriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceProperties = Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanUnitPrice(Models::NewPlanUnitPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanUnitPriceVariant(NewPlanUnitPrice Value) + : Price2, + IVariant { - public static NewPlanUnitPrice From(Models::NewPlanUnitPrice value) + public static NewPlanUnitPriceVariant From(NewPlanUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanPackagePrice(Models::NewPlanPackagePrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanPackagePriceVariant(NewPlanPackagePrice Value) + : Price2, + IVariant { - public static NewPlanPackagePrice From(Models::NewPlanPackagePrice value) + public static NewPlanPackagePriceVariant From(NewPlanPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanMatrixPrice(Models::NewPlanMatrixPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanMatrixPriceVariant(NewPlanMatrixPrice Value) + : Price2, + IVariant { - public static NewPlanMatrixPrice From(Models::NewPlanMatrixPrice value) + public static NewPlanMatrixPriceVariant From(NewPlanMatrixPrice value) { return new(value); } @@ -59,14 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredPrice(Models::NewPlanTieredPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredPriceVariant(NewPlanTieredPrice Value) + : Price2, + IVariant { - public static NewPlanTieredPrice From(Models::NewPlanTieredPrice value) + public static NewPlanTieredPriceVariant From(NewPlanTieredPrice value) { return new(value); } @@ -77,14 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanTieredBPSPrice(Models::NewPlanTieredBPSPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanTieredBPSPriceVariant(NewPlanTieredBPSPrice Value) + : Price2, + IVariant { - public static NewPlanTieredBPSPrice From(Models::NewPlanTieredBPSPrice value) + public static NewPlanTieredBPSPriceVariant From(NewPlanTieredBPSPrice value) { return new(value); } @@ -95,14 +82,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBPSPrice(Models::NewPlanBPSPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBPSPriceVariant(NewPlanBPSPrice Value) + : Price2, + IVariant { - public static NewPlanBPSPrice From(Models::NewPlanBPSPrice value) + public static NewPlanBPSPriceVariant From(NewPlanBPSPrice value) { return new(value); } @@ -113,14 +98,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkBPSPrice(Models::NewPlanBulkBPSPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkBPSPriceVariant(NewPlanBulkBPSPrice Value) + : Price2, + IVariant { - public static NewPlanBulkBPSPrice From(Models::NewPlanBulkBPSPrice value) + public static NewPlanBulkBPSPriceVariant From(NewPlanBulkBPSPrice value) { return new(value); } @@ -131,14 +114,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPlanBulkPrice(Models::NewPlanBulkPrice Value) - : PriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPlanBulkPriceVariant(NewPlanBulkPrice Value) + : Price2, + IVariant { - public static NewPlanBulkPrice From(Models::NewPlanBulkPrice value) + public static NewPlanBulkPriceVariant From(NewPlanBulkPrice value) { return new(value); } @@ -149,20 +130,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanThresholdTotalAmountPrice, - Models::NewPlanThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanThresholdTotalAmountPriceVariant, + NewPlanThresholdTotalAmountPrice >) )] -public sealed record class NewPlanThresholdTotalAmountPrice( - Models::NewPlanThresholdTotalAmountPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanThresholdTotalAmountPriceVariant( + NewPlanThresholdTotalAmountPrice Value +) : Price2, IVariant { - public static NewPlanThresholdTotalAmountPrice From( - Models::NewPlanThresholdTotalAmountPrice value + public static NewPlanThresholdTotalAmountPriceVariant From( + NewPlanThresholdTotalAmountPrice value ) { return new(value); @@ -174,14 +153,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredPackagePrice(Models::NewPlanTieredPackagePrice Value) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredPackagePriceVariant(NewPlanTieredPackagePrice Value) + : Price2, + IVariant { - public static NewPlanTieredPackagePrice From(Models::NewPlanTieredPackagePrice value) + public static NewPlanTieredPackagePriceVariant From(NewPlanTieredPackagePrice value) { return new(value); } @@ -192,19 +171,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredWithMinimumPrice, - Models::NewPlanTieredWithMinimumPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTieredWithMinimumPrice( - Models::NewPlanTieredWithMinimumPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTieredWithMinimumPriceVariant(NewPlanTieredWithMinimumPrice Value) + : Price2, + IVariant { - public static NewPlanTieredWithMinimumPrice From(Models::NewPlanTieredWithMinimumPrice value) + public static NewPlanTieredWithMinimumPriceVariant From(NewPlanTieredWithMinimumPrice value) { return new(value); } @@ -215,14 +189,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithPercentPrice(Models::NewPlanUnitWithPercentPrice Value) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithPercentPriceVariant(NewPlanUnitWithPercentPrice Value) + : Price2, + IVariant { - public static NewPlanUnitWithPercentPrice From(Models::NewPlanUnitWithPercentPrice value) + public static NewPlanUnitWithPercentPriceVariant From(NewPlanUnitWithPercentPrice value) { return new(value); } @@ -233,20 +207,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanPackageWithAllocationPrice, - Models::NewPlanPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanPackageWithAllocationPriceVariant, + NewPlanPackageWithAllocationPrice >) )] -public sealed record class NewPlanPackageWithAllocationPrice( - Models::NewPlanPackageWithAllocationPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanPackageWithAllocationPriceVariant( + NewPlanPackageWithAllocationPrice Value +) : Price2, IVariant { - public static NewPlanPackageWithAllocationPrice From( - Models::NewPlanPackageWithAllocationPrice value + public static NewPlanPackageWithAllocationPriceVariant From( + NewPlanPackageWithAllocationPrice value ) { return new(value); @@ -258,19 +230,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTierWithProrationPrice, - Models::NewPlanTierWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanTierWithProrationPrice( - Models::NewPlanTierWithProrationPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanTierWithProrationPriceVariant(NewPlanTierWithProrationPrice Value) + : Price2, + IVariant { - public static NewPlanTierWithProrationPrice From(Models::NewPlanTierWithProrationPrice value) + public static NewPlanTierWithProrationPriceVariant From(NewPlanTierWithProrationPrice value) { return new(value); } @@ -281,19 +248,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanUnitWithProrationPrice, - Models::NewPlanUnitWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanUnitWithProrationPrice( - Models::NewPlanUnitWithProrationPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanUnitWithProrationPriceVariant(NewPlanUnitWithProrationPrice Value) + : Price2, + IVariant { - public static NewPlanUnitWithProrationPrice From(Models::NewPlanUnitWithProrationPrice value) + public static NewPlanUnitWithProrationPriceVariant From(NewPlanUnitWithProrationPrice value) { return new(value); } @@ -304,19 +266,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedAllocationPrice, - Models::NewPlanGroupedAllocationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedAllocationPrice( - Models::NewPlanGroupedAllocationPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedAllocationPriceVariant(NewPlanGroupedAllocationPrice Value) + : Price2, + IVariant { - public static NewPlanGroupedAllocationPrice From(Models::NewPlanGroupedAllocationPrice value) + public static NewPlanGroupedAllocationPriceVariant From(NewPlanGroupedAllocationPrice value) { return new(value); } @@ -327,23 +284,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice >) )] -public sealed record class NewPlanGroupedWithProratedMinimumPrice( - Models::NewPlanGroupedWithProratedMinimumPrice Value +public sealed record class NewPlanGroupedWithProratedMinimumPriceVariant( + NewPlanGroupedWithProratedMinimumPrice Value ) - : PriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithProratedMinimumPrice, - Models::NewPlanGroupedWithProratedMinimumPrice + : Price2, + IVariant< + NewPlanGroupedWithProratedMinimumPriceVariant, + NewPlanGroupedWithProratedMinimumPrice > { - public static NewPlanGroupedWithProratedMinimumPrice From( - Models::NewPlanGroupedWithProratedMinimumPrice value + public static NewPlanGroupedWithProratedMinimumPriceVariant From( + NewPlanGroupedWithProratedMinimumPrice value ) { return new(value); @@ -355,23 +312,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewPlanGroupedWithMeteredMinimumPrice( - Models::NewPlanGroupedWithMeteredMinimumPrice Value +public sealed record class NewPlanGroupedWithMeteredMinimumPriceVariant( + NewPlanGroupedWithMeteredMinimumPrice Value ) - : PriceProperties::Price, - Orb::IVariant< - NewPlanGroupedWithMeteredMinimumPrice, - Models::NewPlanGroupedWithMeteredMinimumPrice + : Price2, + IVariant< + NewPlanGroupedWithMeteredMinimumPriceVariant, + NewPlanGroupedWithMeteredMinimumPrice > { - public static NewPlanGroupedWithMeteredMinimumPrice From( - Models::NewPlanGroupedWithMeteredMinimumPrice value + public static NewPlanGroupedWithMeteredMinimumPriceVariant From( + NewPlanGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -383,20 +340,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithDisplayNamePrice, - Models::NewPlanMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithDisplayNamePriceVariant, + NewPlanMatrixWithDisplayNamePrice >) )] -public sealed record class NewPlanMatrixWithDisplayNamePrice( - Models::NewPlanMatrixWithDisplayNamePrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithDisplayNamePriceVariant( + NewPlanMatrixWithDisplayNamePrice Value +) : Price2, IVariant { - public static NewPlanMatrixWithDisplayNamePrice From( - Models::NewPlanMatrixWithDisplayNamePrice value + public static NewPlanMatrixWithDisplayNamePriceVariant From( + NewPlanMatrixWithDisplayNamePrice value ) { return new(value); @@ -408,19 +363,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanBulkWithProrationPrice, - Models::NewPlanBulkWithProrationPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanBulkWithProrationPrice( - Models::NewPlanBulkWithProrationPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanBulkWithProrationPriceVariant(NewPlanBulkWithProrationPrice Value) + : Price2, + IVariant { - public static NewPlanBulkWithProrationPrice From(Models::NewPlanBulkWithProrationPrice value) + public static NewPlanBulkWithProrationPriceVariant From(NewPlanBulkWithProrationPrice value) { return new(value); } @@ -431,20 +381,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanGroupedTieredPackagePrice, - Models::NewPlanGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanGroupedTieredPackagePriceVariant, + NewPlanGroupedTieredPackagePrice >) )] -public sealed record class NewPlanGroupedTieredPackagePrice( - Models::NewPlanGroupedTieredPackagePrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPackagePriceVariant( + NewPlanGroupedTieredPackagePrice Value +) : Price2, IVariant { - public static NewPlanGroupedTieredPackagePrice From( - Models::NewPlanGroupedTieredPackagePrice value + public static NewPlanGroupedTieredPackagePriceVariant From( + NewPlanGroupedTieredPackagePrice value ) { return new(value); @@ -456,20 +404,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMaxGroupTieredPackagePrice, - Models::NewPlanMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMaxGroupTieredPackagePriceVariant, + NewPlanMaxGroupTieredPackagePrice >) )] -public sealed record class NewPlanMaxGroupTieredPackagePrice( - Models::NewPlanMaxGroupTieredPackagePrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMaxGroupTieredPackagePriceVariant( + NewPlanMaxGroupTieredPackagePrice Value +) : Price2, IVariant { - public static NewPlanMaxGroupTieredPackagePrice From( - Models::NewPlanMaxGroupTieredPackagePrice value + public static NewPlanMaxGroupTieredPackagePriceVariant From( + NewPlanMaxGroupTieredPackagePrice value ) { return new(value); @@ -481,23 +427,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithUnitPricingPrice( - Models::NewPlanScalableMatrixWithUnitPricingPrice Value +public sealed record class NewPlanScalableMatrixWithUnitPricingPriceVariant( + NewPlanScalableMatrixWithUnitPricingPrice Value ) - : PriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithUnitPricingPrice, - Models::NewPlanScalableMatrixWithUnitPricingPrice + : Price2, + IVariant< + NewPlanScalableMatrixWithUnitPricingPriceVariant, + NewPlanScalableMatrixWithUnitPricingPrice > { - public static NewPlanScalableMatrixWithUnitPricingPrice From( - Models::NewPlanScalableMatrixWithUnitPricingPrice value + public static NewPlanScalableMatrixWithUnitPricingPriceVariant From( + NewPlanScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -509,23 +455,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewPlanScalableMatrixWithTieredPricingPrice( - Models::NewPlanScalableMatrixWithTieredPricingPrice Value +public sealed record class NewPlanScalableMatrixWithTieredPricingPriceVariant( + NewPlanScalableMatrixWithTieredPricingPrice Value ) - : PriceProperties::Price, - Orb::IVariant< - NewPlanScalableMatrixWithTieredPricingPrice, - Models::NewPlanScalableMatrixWithTieredPricingPrice + : Price2, + IVariant< + NewPlanScalableMatrixWithTieredPricingPriceVariant, + NewPlanScalableMatrixWithTieredPricingPrice > { - public static NewPlanScalableMatrixWithTieredPricingPrice From( - Models::NewPlanScalableMatrixWithTieredPricingPrice value + public static NewPlanScalableMatrixWithTieredPricingPriceVariant From( + NewPlanScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -537,20 +483,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanCumulativeGroupedBulkPrice, - Models::NewPlanCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanCumulativeGroupedBulkPriceVariant, + NewPlanCumulativeGroupedBulkPrice >) )] -public sealed record class NewPlanCumulativeGroupedBulkPrice( - Models::NewPlanCumulativeGroupedBulkPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanCumulativeGroupedBulkPriceVariant( + NewPlanCumulativeGroupedBulkPrice Value +) : Price2, IVariant { - public static NewPlanCumulativeGroupedBulkPrice From( - Models::NewPlanCumulativeGroupedBulkPrice value + public static NewPlanCumulativeGroupedBulkPriceVariant From( + NewPlanCumulativeGroupedBulkPrice value ) { return new(value); @@ -562,23 +506,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanTieredPackageWithMinimumPriceVariant, + NewPlanTieredPackageWithMinimumPrice >) )] -public sealed record class NewPlanTieredPackageWithMinimumPrice( - Models::NewPlanTieredPackageWithMinimumPrice Value +public sealed record class NewPlanTieredPackageWithMinimumPriceVariant( + NewPlanTieredPackageWithMinimumPrice Value ) - : PriceProperties::Price, - Orb::IVariant< - NewPlanTieredPackageWithMinimumPrice, - Models::NewPlanTieredPackageWithMinimumPrice - > + : Price2, + IVariant { - public static NewPlanTieredPackageWithMinimumPrice From( - Models::NewPlanTieredPackageWithMinimumPrice value + public static NewPlanTieredPackageWithMinimumPriceVariant From( + NewPlanTieredPackageWithMinimumPrice value ) { return new(value); @@ -590,20 +531,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewPlanMatrixWithAllocationPrice, - Models::NewPlanMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewPlanMatrixWithAllocationPriceVariant, + NewPlanMatrixWithAllocationPrice >) )] -public sealed record class NewPlanMatrixWithAllocationPrice( - Models::NewPlanMatrixWithAllocationPrice Value -) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanMatrixWithAllocationPriceVariant( + NewPlanMatrixWithAllocationPrice Value +) : Price2, IVariant { - public static NewPlanMatrixWithAllocationPrice From( - Models::NewPlanMatrixWithAllocationPrice value + public static NewPlanMatrixWithAllocationPriceVariant From( + NewPlanMatrixWithAllocationPrice value ) { return new(value); @@ -615,14 +554,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewPlanGroupedTieredPrice(Models::NewPlanGroupedTieredPrice Value) - : PriceProperties::Price, - Orb::IVariant +public sealed record class NewPlanGroupedTieredPriceVariant(NewPlanGroupedTieredPrice Value) + : Price2, + IVariant { - public static NewPlanGroupedTieredPrice From(Models::NewPlanGroupedTieredPrice value) + public static NewPlanGroupedTieredPriceVariant From(NewPlanGroupedTieredPrice value) { return new(value); } diff --git a/src/Orb/Models/Plans/PlanCreateParamsProperties/Status.cs b/src/Orb/Models/Plans/PlanCreateParamsProperties/Status.cs index 48186f3b..4ee3bd81 100644 --- a/src/Orb/Models/Plans/PlanCreateParamsProperties/Status.cs +++ b/src/Orb/Models/Plans/PlanCreateParamsProperties/Status.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanCreateParamsProperties; @@ -8,8 +7,8 @@ namespace Orb.Models.Plans.PlanCreateParamsProperties; /// The status of the plan to create (either active or draft). If not specified, this /// defaults to active. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -28,7 +27,7 @@ public Value Known() => { "active" => Value.Active, "draft" => Value.Draft, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/PlanFetchParams.cs b/src/Orb/Models/Plans/PlanFetchParams.cs index 95823a0f..6b43012b 100644 --- a/src/Orb/Models/Plans/PlanFetchParams.cs +++ b/src/Orb/Models/Plans/PlanFetchParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Plans; @@ -17,13 +16,13 @@ namespace Orb.Models.Plans; /// ## Phases Orb supports plan phases, also known as contract ramps. For plans with /// phases, the serialized prices refer to all prices across all phases. /// -public sealed record class PlanFetchParams : Orb::ParamsBase +public sealed record class PlanFetchParams : ParamsBase { public required string PlanID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/{0}", this.PlanID) ) { @@ -31,12 +30,12 @@ public sealed record class PlanFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Plans/PlanListPageResponse.cs b/src/Orb/Models/Plans/PlanListPageResponse.cs index 2dbec544..2ae24455 100644 --- a/src/Orb/Models/Plans/PlanListPageResponse.cs +++ b/src/Orb/Models/Plans/PlanListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Plans; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PlanListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PlanListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("pagination_metadata"); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("pagination_metadata"); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +51,14 @@ public override void Validate() public PlanListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PlanListPageResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static PlanListPageResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanListParams.cs b/src/Orb/Models/Plans/PlanListParams.cs index 7ad8f9ba..d4a2fcc8 100644 --- a/src/Orb/Models/Plans/PlanListParams.cs +++ b/src/Orb/Models/Plans/PlanListParams.cs @@ -1,8 +1,7 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Net.Http; +using System.Text.Json; using PlanListParamsProperties = Orb.Models.Plans.PlanListParamsProperties; -using System = System; namespace Orb.Models.Plans; @@ -12,70 +11,54 @@ namespace Orb.Models.Plans; /// recently created plan. The response also includes [`pagination_metadata`](/api-reference/pagination), /// which lets the caller retrieve the next page of results if they exist. /// -public sealed record class PlanListParams : Orb::ParamsBase +public sealed record class PlanListParams : ParamsBase { - public System::DateTime? CreatedAtGt + public DateTime? CreatedAtGt { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtGte + public DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtLt + public DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } - public System::DateTime? CreatedAtLte + public DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -86,12 +69,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,12 +84,12 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } /// @@ -116,28 +99,28 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("status", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["status"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/plans") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/plans") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Plans/PlanListParamsProperties/Status.cs b/src/Orb/Models/Plans/PlanListParamsProperties/Status.cs index 187f1898..bb3dce16 100644 --- a/src/Orb/Models/Plans/PlanListParamsProperties/Status.cs +++ b/src/Orb/Models/Plans/PlanListParamsProperties/Status.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanListParamsProperties; /// /// The plan status to filter to ('active', 'archived', or 'draft'). /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -31,7 +30,7 @@ public Value Known() => "active" => Value.Active, "archived" => Value.Archived, "draft" => Value.Draft, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/PlanProperties/Adjustment.cs b/src/Orb/Models/Plans/PlanProperties/Adjustment.cs index 85e5a339..ce09de21 100644 --- a/src/Orb/Models/Plans/PlanProperties/Adjustment.cs +++ b/src/Orb/Models/Plans/PlanProperties/Adjustment.cs @@ -1,34 +1,27 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Plans.PlanProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::PlanPhaseUsageDiscountAdjustment Create( - Models::PlanPhaseUsageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseUsageDiscountAdjustment value) => + new AdjustmentVariants::PlanPhaseUsageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseAmountDiscountAdjustment Create( - Models::PlanPhaseAmountDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseAmountDiscountAdjustment value) => + new AdjustmentVariants::PlanPhaseAmountDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhasePercentageDiscountAdjustment Create( - Models::PlanPhasePercentageDiscountAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhasePercentageDiscountAdjustment value) => + new AdjustmentVariants::PlanPhasePercentageDiscountAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseMinimumAdjustment Create( - Models::PlanPhaseMinimumAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseMinimumAdjustment value) => + new AdjustmentVariants::PlanPhaseMinimumAdjustmentVariant(value); - public static AdjustmentVariants::PlanPhaseMaximumAdjustment Create( - Models::PlanPhaseMaximumAdjustment value - ) => new(value); + public static implicit operator Adjustment(PlanPhaseMaximumAdjustment value) => + new AdjustmentVariants::PlanPhaseMaximumAdjustmentVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Plans/PlanProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Plans/PlanProperties/AdjustmentVariants/All.cs index 8c21eff0..80ae0434 100644 --- a/src/Orb/Models/Plans/PlanProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Plans/PlanProperties/AdjustmentVariants/All.cs @@ -1,24 +1,19 @@ -using Models = Orb.Models; -using Orb = Orb; -using PlanProperties = Orb.Models.Plans.PlanProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhaseUsageDiscountAdjustment, - Models::PlanPhaseUsageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhaseUsageDiscountAdjustmentVariant, + PlanPhaseUsageDiscountAdjustment >) )] -public sealed record class PlanPhaseUsageDiscountAdjustment( - Models::PlanPhaseUsageDiscountAdjustment Value -) - : PlanProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseUsageDiscountAdjustmentVariant( + PlanPhaseUsageDiscountAdjustment Value +) : Adjustment, IVariant { - public static PlanPhaseUsageDiscountAdjustment From( - Models::PlanPhaseUsageDiscountAdjustment value + public static PlanPhaseUsageDiscountAdjustmentVariant From( + PlanPhaseUsageDiscountAdjustment value ) { return new(value); @@ -30,20 +25,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhaseAmountDiscountAdjustment, - Models::PlanPhaseAmountDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhaseAmountDiscountAdjustmentVariant, + PlanPhaseAmountDiscountAdjustment >) )] -public sealed record class PlanPhaseAmountDiscountAdjustment( - Models::PlanPhaseAmountDiscountAdjustment Value +public sealed record class PlanPhaseAmountDiscountAdjustmentVariant( + PlanPhaseAmountDiscountAdjustment Value ) - : PlanProperties::Adjustment, - Orb::IVariant + : Adjustment, + IVariant { - public static PlanPhaseAmountDiscountAdjustment From( - Models::PlanPhaseAmountDiscountAdjustment value + public static PlanPhaseAmountDiscountAdjustmentVariant From( + PlanPhaseAmountDiscountAdjustment value ) { return new(value); @@ -55,23 +50,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - PlanPhasePercentageDiscountAdjustment, - Models::PlanPhasePercentageDiscountAdjustment +[JsonConverter( + typeof(VariantConverter< + PlanPhasePercentageDiscountAdjustmentVariant, + PlanPhasePercentageDiscountAdjustment >) )] -public sealed record class PlanPhasePercentageDiscountAdjustment( - Models::PlanPhasePercentageDiscountAdjustment Value +public sealed record class PlanPhasePercentageDiscountAdjustmentVariant( + PlanPhasePercentageDiscountAdjustment Value ) - : PlanProperties::Adjustment, - Orb::IVariant< - PlanPhasePercentageDiscountAdjustment, - Models::PlanPhasePercentageDiscountAdjustment + : Adjustment, + IVariant< + PlanPhasePercentageDiscountAdjustmentVariant, + PlanPhasePercentageDiscountAdjustment > { - public static PlanPhasePercentageDiscountAdjustment From( - Models::PlanPhasePercentageDiscountAdjustment value + public static PlanPhasePercentageDiscountAdjustmentVariant From( + PlanPhasePercentageDiscountAdjustment value ) { return new(value); @@ -83,14 +78,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PlanPhaseMinimumAdjustment(Models::PlanPhaseMinimumAdjustment Value) - : PlanProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseMinimumAdjustmentVariant(PlanPhaseMinimumAdjustment Value) + : Adjustment, + IVariant { - public static PlanPhaseMinimumAdjustment From(Models::PlanPhaseMinimumAdjustment value) + public static PlanPhaseMinimumAdjustmentVariant From(PlanPhaseMinimumAdjustment value) { return new(value); } @@ -101,14 +96,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PlanPhaseMaximumAdjustment(Models::PlanPhaseMaximumAdjustment Value) - : PlanProperties::Adjustment, - Orb::IVariant +public sealed record class PlanPhaseMaximumAdjustmentVariant(PlanPhaseMaximumAdjustment Value) + : Adjustment, + IVariant { - public static PlanPhaseMaximumAdjustment From(Models::PlanPhaseMaximumAdjustment value) + public static PlanPhaseMaximumAdjustmentVariant From(PlanPhaseMaximumAdjustment value) { return new(value); } diff --git a/src/Orb/Models/Plans/PlanProperties/BasePlan.cs b/src/Orb/Models/Plans/PlanProperties/BasePlan.cs index 64dc97ce..3532a417 100644 --- a/src/Orb/Models/Plans/PlanProperties/BasePlan.cs +++ b/src/Orb/Models/Plans/PlanProperties/BasePlan.cs @@ -1,25 +1,24 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BasePlan : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BasePlan : ModelBase, IFromRaw { public required string? ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -31,30 +30,27 @@ public required string? ExternalPlanID { get { - if (!this.Properties.TryGetValue("external_plan_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_plan_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_plan_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_plan_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } public required string? Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -67,16 +63,14 @@ public override void Validate() public BasePlan() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BasePlan(Generic::Dictionary properties) + [SetsRequiredMembers] + BasePlan(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BasePlan FromRawUnchecked( - Generic::Dictionary properties - ) + public static BasePlan FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanProperties/PlanPhase.cs b/src/Orb/Models/Plans/PlanProperties/PlanPhase.cs index f1a5274e..feac5fd8 100644 --- a/src/Orb/Models/Plans/PlanProperties/PlanPhase.cs +++ b/src/Orb/Models/Plans/PlanProperties/PlanPhase.cs @@ -1,58 +1,51 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; using PlanPhaseProperties = Orb.Models.Plans.PlanProperties.PlanPhaseProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Plans.PlanProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PlanPhase : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PlanPhase : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string? Description { get { - if (!this.Properties.TryGetValue("description", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "description", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("description", out JsonElement element)) + throw new ArgumentOutOfRangeException("description", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["description"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -63,103 +56,91 @@ public required long? Duration { get { - if (!this.Properties.TryGetValue("duration", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "duration", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("duration", out JsonElement element)) + throw new ArgumentOutOfRangeException("duration", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration"] = JsonSerializer.SerializeToElement(value); } } public required PlanPhaseProperties::DurationUnit? DurationUnit { get { - if (!this.Properties.TryGetValue("duration_unit", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "duration_unit", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("duration_unit", out JsonElement element)) + throw new ArgumentOutOfRangeException("duration_unit", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["duration_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["duration_unit"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -169,12 +150,12 @@ public required long Order { get { - if (!this.Properties.TryGetValue("order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("order", "Missing required argument"); + if (!this.Properties.TryGetValue("order", out JsonElement element)) + throw new ArgumentOutOfRangeException("order", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["order"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["order"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -195,16 +176,14 @@ public override void Validate() public PlanPhase() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PlanPhase(Generic::Dictionary properties) + [SetsRequiredMembers] + PlanPhase(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PlanPhase FromRawUnchecked( - Generic::Dictionary properties - ) + public static PlanPhase FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanProperties/PlanPhaseProperties/DurationUnit.cs b/src/Orb/Models/Plans/PlanProperties/PlanPhaseProperties/DurationUnit.cs index 4cea5df1..d2510528 100644 --- a/src/Orb/Models/Plans/PlanProperties/PlanPhaseProperties/DurationUnit.cs +++ b/src/Orb/Models/Plans/PlanProperties/PlanPhaseProperties/DurationUnit.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties.PlanPhaseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DurationUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DurationUnit(string value) : IEnum { public static readonly DurationUnit Daily = new("daily"); @@ -36,7 +35,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/PlanProperties/Product.cs b/src/Orb/Models/Plans/PlanProperties/Product.cs index 7aae4f67..dd0387f9 100644 --- a/src/Orb/Models/Plans/PlanProperties/Product.cs +++ b/src/Orb/Models/Plans/PlanProperties/Product.cs @@ -1,54 +1,50 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Product : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Product : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -61,16 +57,14 @@ public override void Validate() public Product() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Product(Generic::Dictionary properties) + [SetsRequiredMembers] + Product(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Product FromRawUnchecked( - Generic::Dictionary properties - ) + public static Product FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanProperties/Status.cs b/src/Orb/Models/Plans/PlanProperties/Status.cs index 04d48a3a..16c6cbff 100644 --- a/src/Orb/Models/Plans/PlanProperties/Status.cs +++ b/src/Orb/Models/Plans/PlanProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -28,7 +27,7 @@ public Value Known() => "active" => Value.Active, "archived" => Value.Archived, "draft" => Value.Draft, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/PlanProperties/TrialConfig.cs b/src/Orb/Models/Plans/PlanProperties/TrialConfig.cs index 4bb4de54..a535bc6d 100644 --- a/src/Orb/Models/Plans/PlanProperties/TrialConfig.cs +++ b/src/Orb/Models/Plans/PlanProperties/TrialConfig.cs @@ -1,48 +1,41 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using TrialConfigProperties = Orb.Models.Plans.PlanProperties.TrialConfigProperties; namespace Orb.Models.Plans.PlanProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TrialConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TrialConfig : ModelBase, IFromRaw { public required long? TrialPeriod { get { - if (!this.Properties.TryGetValue("trial_period", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "trial_period", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("trial_period", out JsonElement element)) + throw new ArgumentOutOfRangeException("trial_period", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["trial_period"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["trial_period"] = JsonSerializer.SerializeToElement(value); } } public required TrialConfigProperties::TrialPeriodUnit TrialPeriodUnit { get { - if (!this.Properties.TryGetValue("trial_period_unit", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("trial_period_unit", out JsonElement element)) + throw new ArgumentOutOfRangeException( "trial_period_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("trial_period_unit"); - } - set - { - this.Properties["trial_period_unit"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("trial_period_unit"); } + set { this.Properties["trial_period_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,16 +47,14 @@ public override void Validate() public TrialConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TrialConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + TrialConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TrialConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static TrialConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Plans/PlanProperties/TrialConfigProperties/TrialPeriodUnit.cs b/src/Orb/Models/Plans/PlanProperties/TrialConfigProperties/TrialPeriodUnit.cs index 3fcb7bfb..fdc0de80 100644 --- a/src/Orb/Models/Plans/PlanProperties/TrialConfigProperties/TrialPeriodUnit.cs +++ b/src/Orb/Models/Plans/PlanProperties/TrialConfigProperties/TrialPeriodUnit.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Plans.PlanProperties.TrialConfigProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class TrialPeriodUnit(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class TrialPeriodUnit(string value) : IEnum { public static readonly TrialPeriodUnit Days = new("days"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "days" => Value.Days, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Plans/PlanUpdateParams.cs b/src/Orb/Models/Plans/PlanUpdateParams.cs index 637bbf58..3da961d5 100644 --- a/src/Orb/Models/Plans/PlanUpdateParams.cs +++ b/src/Orb/Models/Plans/PlanUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Plans; @@ -13,9 +12,9 @@ namespace Orb.Models.Plans; /// /// Other fields on a plan are currently immutable. /// -public sealed record class PlanUpdateParams : Orb::ParamsBase +public sealed record class PlanUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string PlanID; @@ -28,17 +27,12 @@ public string? ExternalPlanID { get { - if (!this.BodyProperties.TryGetValue("external_plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("external_plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["external_plan_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -46,21 +40,21 @@ public string? ExternalPlanID /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/plans/{0}", this.PlanID) ) { @@ -68,21 +62,21 @@ public string? ExternalPlanID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Price.cs b/src/Orb/Models/Price.cs index c70602d8..8898da4b 100644 --- a/src/Orb/Models/Price.cs +++ b/src/Orb/Models/Price.cs @@ -1,7 +1,6 @@ -using Orb = Orb; +using System.Text.Json.Serialization; using PriceProperties = Orb.Models.PriceProperties; using PriceVariants = Orb.Models.PriceVariants; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models; @@ -16,103 +15,97 @@ namespace Orb.Models; /// /// For more on the types of prices, see [the core concepts documentation](/core-concepts#plan-and-price) /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Price { internal Price() { } - public static PriceVariants::Unit Create(PriceProperties::Unit value) => new(value); + public static implicit operator Price(PriceProperties::Unit value) => + new PriceVariants::Unit(value); - public static PriceVariants::Package Create(PriceProperties::Package value) => new(value); + public static implicit operator Price(PriceProperties::Package value) => + new PriceVariants::Package(value); - public static PriceVariants::Matrix Create(PriceProperties::Matrix value) => new(value); + public static implicit operator Price(PriceProperties::Matrix value) => + new PriceVariants::Matrix(value); - public static PriceVariants::Tiered Create(PriceProperties::Tiered value) => new(value); + public static implicit operator Price(PriceProperties::Tiered value) => + new PriceVariants::Tiered(value); - public static PriceVariants::TieredBPS Create(PriceProperties::TieredBPS value) => new(value); + public static implicit operator Price(PriceProperties::TieredBPS value) => + new PriceVariants::TieredBPS(value); - public static PriceVariants::BPS Create(PriceProperties::BPS value) => new(value); + public static implicit operator Price(PriceProperties::BPS value) => + new PriceVariants::BPS(value); - public static PriceVariants::BulkBPS Create(PriceProperties::BulkBPS value) => new(value); + public static implicit operator Price(PriceProperties::BulkBPS value) => + new PriceVariants::BulkBPS(value); - public static PriceVariants::Bulk Create(PriceProperties::Bulk value) => new(value); + public static implicit operator Price(PriceProperties::Bulk value) => + new PriceVariants::Bulk(value); - public static PriceVariants::ThresholdTotalAmount Create( - PriceProperties::ThresholdTotalAmount value - ) => new(value); + public static implicit operator Price(PriceProperties::ThresholdTotalAmount value) => + new PriceVariants::ThresholdTotalAmount(value); - public static PriceVariants::TieredPackage Create(PriceProperties::TieredPackage value) => - new(value); + public static implicit operator Price(PriceProperties::TieredPackage value) => + new PriceVariants::TieredPackage(value); - public static PriceVariants::GroupedTiered Create(PriceProperties::GroupedTiered value) => - new(value); + public static implicit operator Price(PriceProperties::GroupedTiered value) => + new PriceVariants::GroupedTiered(value); - public static PriceVariants::TieredWithMinimum Create( - PriceProperties::TieredWithMinimum value - ) => new(value); + public static implicit operator Price(PriceProperties::TieredWithMinimum value) => + new PriceVariants::TieredWithMinimum(value); - public static PriceVariants::TieredPackageWithMinimum Create( - PriceProperties::TieredPackageWithMinimum value - ) => new(value); + public static implicit operator Price(PriceProperties::TieredPackageWithMinimum value) => + new PriceVariants::TieredPackageWithMinimum(value); - public static PriceVariants::PackageWithAllocation Create( - PriceProperties::PackageWithAllocation value - ) => new(value); + public static implicit operator Price(PriceProperties::PackageWithAllocation value) => + new PriceVariants::PackageWithAllocation(value); - public static PriceVariants::UnitWithPercent Create(PriceProperties::UnitWithPercent value) => - new(value); + public static implicit operator Price(PriceProperties::UnitWithPercent value) => + new PriceVariants::UnitWithPercent(value); - public static PriceVariants::MatrixWithAllocation Create( - PriceProperties::MatrixWithAllocation value - ) => new(value); + public static implicit operator Price(PriceProperties::MatrixWithAllocation value) => + new PriceVariants::MatrixWithAllocation(value); - public static PriceVariants::TieredWithProration Create( - PriceProperties::TieredWithProration value - ) => new(value); + public static implicit operator Price(PriceProperties::TieredWithProration value) => + new PriceVariants::TieredWithProration(value); - public static PriceVariants::UnitWithProration Create( - PriceProperties::UnitWithProration value - ) => new(value); + public static implicit operator Price(PriceProperties::UnitWithProration value) => + new PriceVariants::UnitWithProration(value); - public static PriceVariants::GroupedAllocation Create( - PriceProperties::GroupedAllocation value - ) => new(value); + public static implicit operator Price(PriceProperties::GroupedAllocation value) => + new PriceVariants::GroupedAllocation(value); - public static PriceVariants::GroupedWithProratedMinimum Create( - PriceProperties::GroupedWithProratedMinimum value - ) => new(value); + public static implicit operator Price(PriceProperties::GroupedWithProratedMinimum value) => + new PriceVariants::GroupedWithProratedMinimum(value); - public static PriceVariants::GroupedWithMeteredMinimum Create( - PriceProperties::GroupedWithMeteredMinimum value - ) => new(value); + public static implicit operator Price(PriceProperties::GroupedWithMeteredMinimum value) => + new PriceVariants::GroupedWithMeteredMinimum(value); - public static PriceVariants::MatrixWithDisplayName Create( - PriceProperties::MatrixWithDisplayName value - ) => new(value); + public static implicit operator Price(PriceProperties::MatrixWithDisplayName value) => + new PriceVariants::MatrixWithDisplayName(value); - public static PriceVariants::BulkWithProration Create( - PriceProperties::BulkWithProration value - ) => new(value); + public static implicit operator Price(PriceProperties::BulkWithProration value) => + new PriceVariants::BulkWithProration(value); - public static PriceVariants::GroupedTieredPackage Create( - PriceProperties::GroupedTieredPackage value - ) => new(value); + public static implicit operator Price(PriceProperties::GroupedTieredPackage value) => + new PriceVariants::GroupedTieredPackage(value); - public static PriceVariants::MaxGroupTieredPackage Create( - PriceProperties::MaxGroupTieredPackage value - ) => new(value); + public static implicit operator Price(PriceProperties::MaxGroupTieredPackage value) => + new PriceVariants::MaxGroupTieredPackage(value); - public static PriceVariants::ScalableMatrixWithUnitPricing Create( - PriceProperties::ScalableMatrixWithUnitPricing value - ) => new(value); + public static implicit operator Price(PriceProperties::ScalableMatrixWithUnitPricing value) => + new PriceVariants::ScalableMatrixWithUnitPricing(value); - public static PriceVariants::ScalableMatrixWithTieredPricing Create( - PriceProperties::ScalableMatrixWithTieredPricing value - ) => new(value); + public static implicit operator Price(PriceProperties::ScalableMatrixWithTieredPricing value) => + new PriceVariants::ScalableMatrixWithTieredPricing(value); - public static PriceVariants::CumulativeGroupedBulk Create( - PriceProperties::CumulativeGroupedBulk value - ) => new(value); + public static implicit operator Price(PriceProperties::CumulativeGroupedBulk value) => + new PriceVariants::CumulativeGroupedBulk(value); + + public static implicit operator Price(PriceProperties::GroupedWithMinMaxThresholds value) => + new PriceVariants::GroupedWithMinMaxThresholds(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceInterval.cs b/src/Orb/Models/PriceInterval.cs index 8c630ab4..55f61865 100644 --- a/src/Orb/Models/PriceInterval.cs +++ b/src/Orb/Models/PriceInterval.cs @@ -1,8 +1,7 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; @@ -11,20 +10,20 @@ namespace Orb.Models; /// The Price Interval resource represents a period of time for which a price will /// bill on a subscription. A subscription’s price intervals define its billing behavior. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PriceInterval : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PriceInterval : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,18 +33,15 @@ public required long BillingCycleDay { get { - if (!this.Properties.TryGetValue("billing_cycle_day", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billing_cycle_day", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "billing_cycle_day", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billing_cycle_day"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billing_cycle_day"] = JsonSerializer.SerializeToElement(value); } } /// @@ -60,7 +56,7 @@ public required long BillingCycleDay if ( !this.Properties.TryGetValue( "current_billing_period_end_date", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -68,12 +64,13 @@ public required long BillingCycleDay "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["current_billing_period_end_date"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["current_billing_period_end_date"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -89,7 +86,7 @@ public required long BillingCycleDay if ( !this.Properties.TryGetValue( "current_billing_period_start_date", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -97,12 +94,12 @@ public required long BillingCycleDay "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.Properties["current_billing_period_start_date"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -114,15 +111,15 @@ public required long BillingCycleDay { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -132,29 +129,29 @@ public required string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filter", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// /// The fixed fee quantity transitions for this price interval. This is only relevant /// for fixed fees. /// - public required Generic::List? FixedFeeQuantityTransitions + public required List? FixedFeeQuantityTransitions { get { if ( !this.Properties.TryGetValue( "fixed_fee_quantity_transitions", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -162,14 +159,13 @@ public required string? Filter "Missing required argument" ); - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } set { - this.Properties["fixed_fee_quantity_transitions"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["fixed_fee_quantity_transitions"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,13 +184,13 @@ public required Price Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) throw new System::ArgumentOutOfRangeException("price", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price"); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -205,37 +201,34 @@ public required Price Price { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of customer IDs whose usage events will be aggregated and billed under /// this price interval. /// - public required Generic::List? UsageCustomerIDs + public required List? UsageCustomerIDs { get { - if (!this.Properties.TryGetValue("usage_customer_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_customer_ids", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_customer_ids", "Missing required argument" ); - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -261,16 +254,14 @@ public override void Validate() public PriceInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PriceInterval FromRawUnchecked( - Generic::Dictionary properties - ) + public static PriceInterval FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/BPS.cs b/src/Orb/Models/PriceProperties/BPS.cs index 9e37cf6a..a7571608 100644 --- a/src/Orb/Models/PriceProperties/BPS.cs +++ b/src/Orb/Models/PriceProperties/BPS.cs @@ -1,43 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BPSProperties = Orb.Models.PriceProperties.BPSProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BPS : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BPS : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,174 +66,141 @@ public required string ID { get { - if (!this.Properties.TryGetValue("bps_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "bps_config", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("bps_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("bps_config", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("bps_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("bps_config"); } - set { this.Properties["bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps_config"] = JsonSerializer.SerializeToElement(value); } } public required BPSProperties::Cadence Cadence { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required BPSProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -246,20 +210,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -267,43 +232,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -312,113 +274,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required BPSProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required BPSProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -429,18 +375,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -450,19 +393,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -491,7 +433,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -499,17 +440,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public BPS() { } + public BPS() + { + this.ModelType = JsonSerializer.Deserialize("\"bps\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BPS(Generic::Dictionary properties) + [SetsRequiredMembers] + BPS(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BPS FromRawUnchecked(Generic::Dictionary properties) + public static BPS FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/BPSProperties/Cadence.cs b/src/Orb/Models/PriceProperties/BPSProperties/Cadence.cs index d320f5b8..11e67008 100644 --- a/src/Orb/Models/PriceProperties/BPSProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/BPSProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BPSProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfig.cs index 5593bf57..fe79ea02 100644 --- a/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.BPSProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BPSProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfigVariants/All.cs index 7542fea6..f2a50971 100644 --- a/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/BPSProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using BPSProperties = Orb.Models.PriceProperties.BPSProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BPSProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : BPSProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : BPSProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/BPSProperties/ModelType.cs b/src/Orb/Models/PriceProperties/BPSProperties/ModelType.cs deleted file mode 100644 index 4b294553..00000000 --- a/src/Orb/Models/PriceProperties/BPSProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.BPSProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType BPS = new("bps"); - - readonly string _value = value; - - public enum Value - { - BPS, - } - - public Value Known() => - _value switch - { - "bps" => Value.BPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/BPSProperties/PriceType.cs b/src/Orb/Models/PriceProperties/BPSProperties/PriceType.cs index 8fba1b26..77479dc4 100644 --- a/src/Orb/Models/PriceProperties/BPSProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/BPSProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BPSProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/Bulk.cs b/src/Orb/Models/PriceProperties/Bulk.cs index c724cec2..af9d39ca 100644 --- a/src/Orb/Models/PriceProperties/Bulk.cs +++ b/src/Orb/Models/PriceProperties/Bulk.cs @@ -1,43 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BulkProperties = Orb.Models.PriceProperties.BulkProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Bulk : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Bulk : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,174 +66,141 @@ public required string ID { get { - if (!this.Properties.TryGetValue("bulk_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "bulk_config", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("bulk_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("bulk_config", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("bulk_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("bulk_config"); } - set { this.Properties["bulk_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_config"] = JsonSerializer.SerializeToElement(value); } } public required BulkProperties::Cadence Cadence { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required BulkProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -246,20 +210,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -267,43 +232,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -312,113 +274,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required BulkProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required BulkProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -429,18 +375,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -450,19 +393,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -491,7 +433,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -499,17 +440,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public Bulk() { } + public Bulk() + { + this.ModelType = JsonSerializer.Deserialize("\"bulk\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Bulk(Generic::Dictionary properties) + [SetsRequiredMembers] + Bulk(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Bulk FromRawUnchecked(Generic::Dictionary properties) + public static Bulk FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/BulkBPS.cs b/src/Orb/Models/PriceProperties/BulkBPS.cs index b9ff5f5d..055cdc20 100644 --- a/src/Orb/Models/PriceProperties/BulkBPS.cs +++ b/src/Orb/Models/PriceProperties/BulkBPS.cs @@ -1,43 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BulkBPSProperties = Orb.Models.PriceProperties.BulkBPSProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BulkBPS : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BulkBPS : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,176 +66,144 @@ public required string ID { get { - if (!this.Properties.TryGetValue("bulk_bps_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("bulk_bps_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "bulk_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("bulk_bps_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("bulk_bps_config"); } - set { this.Properties["bulk_bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_bps_config"] = JsonSerializer.SerializeToElement(value); } } public required BulkBPSProperties::Cadence Cadence { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required BulkBPSProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -248,20 +213,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -269,43 +235,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -314,113 +277,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required BulkBPSProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required BulkBPSProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -431,18 +378,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -452,19 +396,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -493,7 +436,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -501,19 +443,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public BulkBPS() { } + public BulkBPS() + { + this.ModelType = JsonSerializer.Deserialize("\"bulk_bps\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BulkBPS(Generic::Dictionary properties) + [SetsRequiredMembers] + BulkBPS(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BulkBPS FromRawUnchecked( - Generic::Dictionary properties - ) + public static BulkBPS FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/BulkBPSProperties/Cadence.cs b/src/Orb/Models/PriceProperties/BulkBPSProperties/Cadence.cs index 76cc0468..c378c777 100644 --- a/src/Orb/Models/PriceProperties/BulkBPSProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/BulkBPSProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkBPSProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfig.cs index 33737790..ad687879 100644 --- a/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.BulkBPSProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkBPSProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfigVariants/All.cs index 5308acca..0b0c61d4 100644 --- a/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/BulkBPSProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using BulkBPSProperties = Orb.Models.PriceProperties.BulkBPSProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkBPSProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : BulkBPSProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : BulkBPSProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/BulkBPSProperties/ModelType.cs b/src/Orb/Models/PriceProperties/BulkBPSProperties/ModelType.cs deleted file mode 100644 index 2bdf4cde..00000000 --- a/src/Orb/Models/PriceProperties/BulkBPSProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.BulkBPSProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType BulkBPS = new("bulk_bps"); - - readonly string _value = value; - - public enum Value - { - BulkBPS, - } - - public Value Known() => - _value switch - { - "bulk_bps" => Value.BulkBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/BulkBPSProperties/PriceType.cs b/src/Orb/Models/PriceProperties/BulkBPSProperties/PriceType.cs index d1b03ed2..959ccb73 100644 --- a/src/Orb/Models/PriceProperties/BulkBPSProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/BulkBPSProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkBPSProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/BulkProperties/Cadence.cs b/src/Orb/Models/PriceProperties/BulkProperties/Cadence.cs index df70b70a..5583f9e0 100644 --- a/src/Orb/Models/PriceProperties/BulkProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/BulkProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfig.cs index dc62d8f9..08d5d59f 100644 --- a/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.BulkProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfigVariants/All.cs index a711eb50..a505dd79 100644 --- a/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/BulkProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using BulkProperties = Orb.Models.PriceProperties.BulkProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : BulkProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : BulkProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/BulkProperties/ModelType.cs b/src/Orb/Models/PriceProperties/BulkProperties/ModelType.cs deleted file mode 100644 index e857d5b0..00000000 --- a/src/Orb/Models/PriceProperties/BulkProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.BulkProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType Bulk = new("bulk"); - - readonly string _value = value; - - public enum Value - { - Bulk, - } - - public Value Known() => - _value switch - { - "bulk" => Value.Bulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/BulkProperties/PriceType.cs b/src/Orb/Models/PriceProperties/BulkProperties/PriceType.cs index fe319ee3..0a7b53f9 100644 --- a/src/Orb/Models/PriceProperties/BulkProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/BulkProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/BulkWithProration.cs b/src/Orb/Models/PriceProperties/BulkWithProration.cs index a07d1038..dc3227ad 100644 --- a/src/Orb/Models/PriceProperties/BulkWithProration.cs +++ b/src/Orb/Models/PriceProperties/BulkWithProration.cs @@ -1,43 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using BulkWithProrationProperties = Orb.Models.PriceProperties.BulkWithProrationProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BulkWithProration : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BulkWithProration : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,48 +44,40 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } - public required Generic::Dictionary BulkWithProrationConfig + public required Dictionary BulkWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "bulk_with_proration_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("bulk_with_proration_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "bulk_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("bulk_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("bulk_with_proration_config"); } set { - this.Properties["bulk_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["bulk_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -96,160 +87,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required BulkWithProrationProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -259,20 +220,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -280,43 +242,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -325,113 +284,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required BulkWithProrationProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required BulkWithProrationProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -442,18 +385,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -463,19 +403,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -507,7 +446,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -515,19 +453,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public BulkWithProration() { } + public BulkWithProration() + { + this.ModelType = JsonSerializer.Deserialize("\"bulk_with_proration\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BulkWithProration(Generic::Dictionary properties) + [SetsRequiredMembers] + BulkWithProration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BulkWithProration FromRawUnchecked( - Generic::Dictionary properties - ) + public static BulkWithProration FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/Cadence.cs b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/Cadence.cs index 13cf8ce3..84a0399d 100644 --- a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfig.cs index 4ba39b10..e107288a 100644 --- a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.BulkWithProrationProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfigVariants/All.cs index 8083f2a4..552765db 100644 --- a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using BulkWithProrationProperties = Orb.Models.PriceProperties.BulkWithProrationProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkWithProrationProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : BulkWithProrationProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : BulkWithProrationProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ModelType.cs b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ModelType.cs deleted file mode 100644 index 97b927e9..00000000 --- a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.BulkWithProrationProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType BulkWithProration = new("bulk_with_proration"); - - readonly string _value = value; - - public enum Value - { - BulkWithProration, - } - - public Value Known() => - _value switch - { - "bulk_with_proration" => Value.BulkWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/PriceType.cs b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/PriceType.cs index e55cedac..91b0a3fa 100644 --- a/src/Orb/Models/PriceProperties/BulkWithProrationProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/BulkWithProrationProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.BulkWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/CumulativeGroupedBulk.cs b/src/Orb/Models/PriceProperties/CumulativeGroupedBulk.cs index c5d42fd6..32fb0e07 100644 --- a/src/Orb/Models/PriceProperties/CumulativeGroupedBulk.cs +++ b/src/Orb/Models/PriceProperties/CumulativeGroupedBulk.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using CumulativeGroupedBulkProperties = Orb.Models.PriceProperties.CumulativeGroupedBulkProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class CumulativeGroupedBulk - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class CumulativeGroupedBulk : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,117 +66,100 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required CumulativeGroupedBulkProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary CumulativeGroupedBulkConfig + public required Dictionary CumulativeGroupedBulkConfig { get { if ( !this.Properties.TryGetValue( "cumulative_grouped_bulk_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "cumulative_grouped_bulk_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("cumulative_grouped_bulk_config"); } set { - this.Properties["cumulative_grouped_bulk_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["cumulative_grouped_bulk_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -189,69 +167,55 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -261,20 +225,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -282,43 +247,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,115 +289,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required CumulativeGroupedBulkProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required CumulativeGroupedBulkProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -446,18 +390,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -511,7 +451,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public CumulativeGroupedBulk() { } + public CumulativeGroupedBulk() + { + this.ModelType = JsonSerializer.Deserialize("\"cumulative_grouped_bulk\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - CumulativeGroupedBulk(Generic::Dictionary properties) + [SetsRequiredMembers] + CumulativeGroupedBulk(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static CumulativeGroupedBulk FromRawUnchecked( - Generic::Dictionary properties - ) + public static CumulativeGroupedBulk FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/Cadence.cs b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/Cadence.cs index 0a3fd001..c3a0fba2 100644 --- a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.CumulativeGroupedBulkProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfig.cs index be3479ee..87413abd 100644 --- a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.CumulativeGroupedBulkProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.CumulativeGroupedBulkProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfigVariants/All.cs index f1a9d167..912d694a 100644 --- a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using CumulativeGroupedBulkProperties = Orb.Models.PriceProperties.CumulativeGroupedBulkProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.CumulativeGroupedBulkProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : CumulativeGroupedBulkProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : CumulativeGroupedBulkProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ModelType.cs b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ModelType.cs deleted file mode 100644 index ea123de5..00000000 --- a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.CumulativeGroupedBulkProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType CumulativeGroupedBulk = new("cumulative_grouped_bulk"); - - readonly string _value = value; - - public enum Value - { - CumulativeGroupedBulk, - } - - public Value Known() => - _value switch - { - "cumulative_grouped_bulk" => Value.CumulativeGroupedBulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/PriceType.cs b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/PriceType.cs index 728fa57b..2e02acf3 100644 --- a/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/CumulativeGroupedBulkProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.CumulativeGroupedBulkProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedAllocation.cs b/src/Orb/Models/PriceProperties/GroupedAllocation.cs index 7bf48028..8a87f9ab 100644 --- a/src/Orb/Models/PriceProperties/GroupedAllocation.cs +++ b/src/Orb/Models/PriceProperties/GroupedAllocation.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using GroupedAllocationProperties = Orb.Models.PriceProperties.GroupedAllocationProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class GroupedAllocation : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class GroupedAllocation : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,186 +66,148 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required GroupedAllocationProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedAllocationConfig + public required Dictionary GroupedAllocationConfig { get { - if ( - !this.Properties.TryGetValue( - "grouped_allocation_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("grouped_allocation_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "grouped_allocation_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("grouped_allocation_config"); } set { - this.Properties["grouped_allocation_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["grouped_allocation_config"] = JsonSerializer.SerializeToElement(value); } } @@ -259,20 +218,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -280,43 +240,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -325,113 +282,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required GroupedAllocationProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required GroupedAllocationProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -442,18 +383,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -463,19 +401,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -507,7 +444,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -515,19 +451,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public GroupedAllocation() { } + public GroupedAllocation() + { + this.ModelType = JsonSerializer.Deserialize("\"grouped_allocation\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - GroupedAllocation(Generic::Dictionary properties) + [SetsRequiredMembers] + GroupedAllocation(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static GroupedAllocation FromRawUnchecked( - Generic::Dictionary properties - ) + public static GroupedAllocation FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/Cadence.cs b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/Cadence.cs index cafb3fb3..2d21928d 100644 --- a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfig.cs index 739e21b9..bd820463 100644 --- a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.GroupedAllocationProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfigVariants/All.cs index 22dacca8..03038918 100644 --- a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using GroupedAllocationProperties = Orb.Models.PriceProperties.GroupedAllocationProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedAllocationProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : GroupedAllocationProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : GroupedAllocationProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ModelType.cs b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ModelType.cs deleted file mode 100644 index 0c314bef..00000000 --- a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.GroupedAllocationProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType GroupedAllocation = new("grouped_allocation"); - - readonly string _value = value; - - public enum Value - { - GroupedAllocation, - } - - public Value Known() => - _value switch - { - "grouped_allocation" => Value.GroupedAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/PriceType.cs b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/PriceType.cs index ac13999c..11812e80 100644 --- a/src/Orb/Models/PriceProperties/GroupedAllocationProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/GroupedAllocationProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedTiered.cs b/src/Orb/Models/PriceProperties/GroupedTiered.cs index f197c098..c97ea73e 100644 --- a/src/Orb/Models/PriceProperties/GroupedTiered.cs +++ b/src/Orb/Models/PriceProperties/GroupedTiered.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using GroupedTieredProperties = Orb.Models.PriceProperties.GroupedTieredProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class GroupedTiered : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class GroupedTiered : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,184 +66,146 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required GroupedTieredProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredConfig + public required Dictionary GroupedTieredConfig { get { - if ( - !this.Properties.TryGetValue("grouped_tiered_config", out Json::JsonElement element) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("grouped_tiered_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "grouped_tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_config"); - } - set - { - this.Properties["grouped_tiered_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("grouped_tiered_config"); } + set { this.Properties["grouped_tiered_config"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -256,20 +215,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -277,43 +237,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -322,113 +279,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required GroupedTieredProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required GroupedTieredProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -439,18 +380,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -460,19 +398,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -504,7 +441,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -512,19 +448,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public GroupedTiered() { } + public GroupedTiered() + { + this.ModelType = JsonSerializer.Deserialize("\"grouped_tiered\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - GroupedTiered(Generic::Dictionary properties) + [SetsRequiredMembers] + GroupedTiered(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static GroupedTiered FromRawUnchecked( - Generic::Dictionary properties - ) + public static GroupedTiered FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/GroupedTieredPackage.cs b/src/Orb/Models/PriceProperties/GroupedTieredPackage.cs index 08174839..dbabfefa 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredPackage.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredPackage.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using GroupedTieredPackageProperties = Orb.Models.PriceProperties.GroupedTieredPackageProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class GroupedTieredPackage - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class GroupedTieredPackage : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,186 +66,155 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required GroupedTieredPackageProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredPackageConfig + public required Dictionary GroupedTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "grouped_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "grouped_tiered_package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("grouped_tiered_package_config"); } set { - this.Properties["grouped_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["grouped_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -261,20 +225,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -282,43 +247,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,115 +289,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required GroupedTieredPackageProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required GroupedTieredPackageProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -446,18 +390,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -511,7 +451,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public GroupedTieredPackage() { } + public GroupedTieredPackage() + { + this.ModelType = JsonSerializer.Deserialize("\"grouped_tiered_package\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - GroupedTieredPackage(Generic::Dictionary properties) + [SetsRequiredMembers] + GroupedTieredPackage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static GroupedTieredPackage FromRawUnchecked( - Generic::Dictionary properties - ) + public static GroupedTieredPackage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/Cadence.cs b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/Cadence.cs index 802981e7..47efef2f 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfig.cs index 424c0ae9..f43abe4e 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.GroupedTieredPackageProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfigVariants/All.cs index 4a28a3f1..1f59f4ed 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using GroupedTieredPackageProperties = Orb.Models.PriceProperties.GroupedTieredPackageProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredPackageProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : GroupedTieredPackageProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : GroupedTieredPackageProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ModelType.cs b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ModelType.cs deleted file mode 100644 index aa00e775..00000000 --- a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.GroupedTieredPackageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType GroupedTieredPackage = new("grouped_tiered_package"); - - readonly string _value = value; - - public enum Value - { - GroupedTieredPackage, - } - - public Value Known() => - _value switch - { - "grouped_tiered_package" => Value.GroupedTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/PriceType.cs b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/PriceType.cs index a3624776..e1f63208 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredPackageProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedTieredProperties/Cadence.cs b/src/Orb/Models/PriceProperties/GroupedTieredProperties/Cadence.cs index c716cdf0..7c57dc2b 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfig.cs index a86b27c4..581f5610 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.GroupedTieredProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfigVariants/All.cs index 7c138f98..bdfbf5cc 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using GroupedTieredProperties = Orb.Models.PriceProperties.GroupedTieredProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : GroupedTieredProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : GroupedTieredProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/GroupedTieredProperties/ModelType.cs b/src/Orb/Models/PriceProperties/GroupedTieredProperties/ModelType.cs deleted file mode 100644 index eccf9fb9..00000000 --- a/src/Orb/Models/PriceProperties/GroupedTieredProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.GroupedTieredProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType GroupedTiered = new("grouped_tiered"); - - readonly string _value = value; - - public enum Value - { - GroupedTiered, - } - - public Value Known() => - _value switch - { - "grouped_tiered" => Value.GroupedTiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/GroupedTieredProperties/PriceType.cs b/src/Orb/Models/PriceProperties/GroupedTieredProperties/PriceType.cs index aac85819..45e9d923 100644 --- a/src/Orb/Models/PriceProperties/GroupedTieredProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/GroupedTieredProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedTieredProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimum.cs b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimum.cs index e299d68c..cceab7ad 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimum.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimum.cs @@ -1,45 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using GroupedWithMeteredMinimumProperties = Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class GroupedWithMeteredMinimum - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +46,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,186 +68,154 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required GroupedWithMeteredMinimumProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithMeteredMinimumConfig + public required Dictionary GroupedWithMeteredMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_metered_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "grouped_with_metered_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("grouped_with_metered_minimum_config"); } set { this.Properties["grouped_with_metered_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -261,20 +226,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -282,43 +248,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,115 +290,98 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required GroupedWithMeteredMinimumProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required GroupedWithMeteredMinimumProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("price_type"); + ) ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -446,18 +392,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -467,19 +410,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -511,7 +453,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,18 +460,23 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public GroupedWithMeteredMinimum() { } + public GroupedWithMeteredMinimum() + { + this.ModelType = JsonSerializer.Deserialize( + "\"grouped_with_metered_minimum\"" + ); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - GroupedWithMeteredMinimum(Generic::Dictionary properties) + [SetsRequiredMembers] + GroupedWithMeteredMinimum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static GroupedWithMeteredMinimum FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/Cadence.cs b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/Cadence.cs index 2264b15a..6c35a1f1 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfig.cs index 8841c792..f0f0c564 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfigVariants/All.cs index 8b464f66..a3c840b5 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using GroupedWithMeteredMinimumProperties = Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : GroupedWithMeteredMinimumProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : GroupedWithMeteredMinimumProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ModelType.cs b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ModelType.cs deleted file mode 100644 index 2c5e63ea..00000000 --- a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/ModelType.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType GroupedWithMeteredMinimum = new( - "grouped_with_metered_minimum" - ); - - readonly string _value = value; - - public enum Value - { - GroupedWithMeteredMinimum, - } - - public Value Known() => - _value switch - { - "grouped_with_metered_minimum" => Value.GroupedWithMeteredMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/PriceType.cs b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/PriceType.cs index 7631eafd..f832feab 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithMeteredMinimumProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithMeteredMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholds.cs b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholds.cs new file mode 100644 index 00000000..92802277 --- /dev/null +++ b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholds.cs @@ -0,0 +1,485 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; +using GroupedWithMinMaxThresholdsProperties = Orb.Models.PriceProperties.GroupedWithMinMaxThresholdsProperties; +using Models = Orb.Models; + +namespace Orb.Models.PriceProperties; + +[JsonConverter(typeof(ModelConverter))] +public sealed record class GroupedWithMinMaxThresholds + : ModelBase, + IFromRaw +{ + public required string ID + { + get + { + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); + } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } + } + + public required Models::BillableMetricTiny? BillableMetric + { + get + { + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "billable_metric", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } + } + + public required Models::BillingCycleConfiguration BillingCycleConfiguration + { + get + { + if ( + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) + ) + throw new ArgumentOutOfRangeException( + "billing_cycle_configuration", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); + } + set + { + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); + } + } + + public required GroupedWithMinMaxThresholdsProperties::Cadence Cadence + { + get + { + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); + + return JsonSerializer.Deserialize( + element + ) ?? throw new ArgumentNullException("cadence"); + } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } + } + + public required double? ConversionRate + { + get + { + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "conversion_rate", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } + } + + public required GroupedWithMinMaxThresholdsProperties::ConversionRateConfig? ConversionRateConfig + { + get + { + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "conversion_rate_config", + "Missing required argument" + ); + + return JsonSerializer.Deserialize( + element + ); + } + set + { + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); + } + } + + public required DateTime CreatedAt + { + get + { + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } + } + + public required Models::Allocation? CreditAllocation + { + get + { + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "credit_allocation", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } + } + + public required string Currency + { + get + { + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); + } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } + } + + public required Models::Discount2? Discount + { + get + { + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } + } + + public required string? ExternalPriceID + { + get + { + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "external_price_id", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } + } + + public required double? FixedPriceQuantity + { + get + { + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "fixed_price_quantity", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } + } + + public required Dictionary GroupedWithMinMaxThresholdsConfig + { + get + { + if ( + !this.Properties.TryGetValue( + "grouped_with_min_max_thresholds_config", + out JsonElement element + ) + ) + throw new ArgumentOutOfRangeException( + "grouped_with_min_max_thresholds_config", + "Missing required argument" + ); + + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("grouped_with_min_max_thresholds_config"); + } + set + { + this.Properties["grouped_with_min_max_thresholds_config"] = + JsonSerializer.SerializeToElement(value); + } + } + + public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration + { + get + { + if ( + !this.Properties.TryGetValue( + "invoicing_cycle_configuration", + out JsonElement element + ) + ) + throw new ArgumentOutOfRangeException( + "invoicing_cycle_configuration", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set + { + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); + } + } + + public required Models::ItemSlim Item + { + get + { + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); + } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } + } + + public required Models::Maximum? Maximum + { + get + { + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } + } + + public required string? MaximumAmount + { + get + { + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "maximum_amount", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } + } + + /// + /// User specified key-value pairs for the resource. If not present, this defaults + /// to an empty dictionary. Individual keys can be removed by setting the value + /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` + /// to `null`. + /// + public required Dictionary Metadata + { + get + { + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); + + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); + } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } + } + + public required Models::Minimum? Minimum + { + get + { + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } + } + + public required string? MinimumAmount + { + get + { + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "minimum_amount", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } + } + + public JsonElement ModelType + { + get + { + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } + } + + public required string Name + { + get + { + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); + + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); + } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } + } + + public required long? PlanPhaseOrder + { + get + { + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "plan_phase_order", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } + } + + public required GroupedWithMinMaxThresholdsProperties::PriceType PriceType + { + get + { + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); + + return JsonSerializer.Deserialize( + element + ) ?? throw new ArgumentNullException("price_type"); + } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } + } + + /// + /// The price id this price replaces. This price will take the place of the replaced + /// price in plan version migrations. + /// + public required string? ReplacesPriceID + { + get + { + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( + "replaces_price_id", + "Missing required argument" + ); + + return JsonSerializer.Deserialize(element); + } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } + } + + public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration + { + get + { + if ( + !this.Properties.TryGetValue( + "dimensional_price_configuration", + out JsonElement element + ) + ) + return null; + + return JsonSerializer.Deserialize(element); + } + set + { + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); + } + } + + public override void Validate() + { + _ = this.ID; + this.BillableMetric?.Validate(); + this.BillingCycleConfiguration.Validate(); + this.Cadence.Validate(); + _ = this.ConversionRate; + this.ConversionRateConfig?.Validate(); + _ = this.CreatedAt; + this.CreditAllocation?.Validate(); + _ = this.Currency; + this.Discount?.Validate(); + _ = this.ExternalPriceID; + _ = this.FixedPriceQuantity; + foreach (var item in this.GroupedWithMinMaxThresholdsConfig.Values) + { + _ = item; + } + this.InvoicingCycleConfiguration?.Validate(); + this.Item.Validate(); + this.Maximum?.Validate(); + _ = this.MaximumAmount; + foreach (var item in this.Metadata.Values) + { + _ = item; + } + this.Minimum?.Validate(); + _ = this.MinimumAmount; + _ = this.Name; + _ = this.PlanPhaseOrder; + this.PriceType.Validate(); + _ = this.ReplacesPriceID; + this.DimensionalPriceConfiguration?.Validate(); + } + + public GroupedWithMinMaxThresholds() + { + this.ModelType = JsonSerializer.Deserialize( + "\"grouped_with_min_max_thresholds\"" + ); + } + +#pragma warning disable CS8618 + [SetsRequiredMembers] + GroupedWithMinMaxThresholds(Dictionary properties) + { + Properties = properties; + } +#pragma warning restore CS8618 + + public static GroupedWithMinMaxThresholds FromRawUnchecked( + Dictionary properties + ) + { + return new(properties); + } +} diff --git a/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/Cadence.cs b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/Cadence.cs new file mode 100644 index 00000000..f74b9ad8 --- /dev/null +++ b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/Cadence.cs @@ -0,0 +1,59 @@ +using System; +using System.Text.Json.Serialization; + +namespace Orb.Models.PriceProperties.GroupedWithMinMaxThresholdsProperties; + +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum +{ + public static readonly Cadence OneTime = new("one_time"); + + public static readonly Cadence Monthly = new("monthly"); + + public static readonly Cadence Quarterly = new("quarterly"); + + public static readonly Cadence SemiAnnual = new("semi_annual"); + + public static readonly Cadence Annual = new("annual"); + + public static readonly Cadence Custom = new("custom"); + + readonly string _value = value; + + public enum Value + { + OneTime, + Monthly, + Quarterly, + SemiAnnual, + Annual, + Custom, + } + + public Value Known() => + _value switch + { + "one_time" => Value.OneTime, + "monthly" => Value.Monthly, + "quarterly" => Value.Quarterly, + "semi_annual" => Value.SemiAnnual, + "annual" => Value.Annual, + "custom" => Value.Custom, + _ => throw new ArgumentOutOfRangeException(nameof(_value)), + }; + + public string Raw() + { + return _value; + } + + public void Validate() + { + Known(); + } + + public static Cadence FromRaw(string value) + { + return new(value); + } +} diff --git a/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/ConversionRateConfig.cs new file mode 100644 index 00000000..d21785da --- /dev/null +++ b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/ConversionRateConfig.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using ConversionRateConfigVariants = Orb.Models.PriceProperties.GroupedWithMinMaxThresholdsProperties.ConversionRateConfigVariants; + +namespace Orb.Models.PriceProperties.GroupedWithMinMaxThresholdsProperties; + +[JsonConverter(typeof(UnionConverter))] +public abstract record class ConversionRateConfig +{ + internal ConversionRateConfig() { } + + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); + + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/ConversionRateConfigVariants/All.cs new file mode 100644 index 00000000..e999a8a8 --- /dev/null +++ b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/ConversionRateConfigVariants/All.cs @@ -0,0 +1,37 @@ +using System.Text.Json.Serialization; + +namespace Orb.Models.PriceProperties.GroupedWithMinMaxThresholdsProperties.ConversionRateConfigVariants; + +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant +{ + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) + { + return new(value); + } + + public override void Validate() + { + this.Value.Validate(); + } +} + +[JsonConverter( + typeof(VariantConverter) +)] +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant +{ + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) + { + return new(value); + } + + public override void Validate() + { + this.Value.Validate(); + } +} diff --git a/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/PriceType.cs b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/PriceType.cs new file mode 100644 index 00000000..2f445108 --- /dev/null +++ b/src/Orb/Models/PriceProperties/GroupedWithMinMaxThresholdsProperties/PriceType.cs @@ -0,0 +1,43 @@ +using System; +using System.Text.Json.Serialization; + +namespace Orb.Models.PriceProperties.GroupedWithMinMaxThresholdsProperties; + +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum +{ + public static readonly PriceType UsagePrice = new("usage_price"); + + public static readonly PriceType FixedPrice = new("fixed_price"); + + readonly string _value = value; + + public enum Value + { + UsagePrice, + FixedPrice, + } + + public Value Known() => + _value switch + { + "usage_price" => Value.UsagePrice, + "fixed_price" => Value.FixedPrice, + _ => throw new ArgumentOutOfRangeException(nameof(_value)), + }; + + public string Raw() + { + return _value; + } + + public void Validate() + { + Known(); + } + + public static PriceType FromRaw(string value) + { + return new(value); + } +} diff --git a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimum.cs b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimum.cs index 41f698c5..0dc69c9e 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimum.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimum.cs @@ -1,45 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using GroupedWithProratedMinimumProperties = Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class GroupedWithProratedMinimum - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +46,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,187 +68,155 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("cadence"); + ) ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required GroupedWithProratedMinimumProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithProratedMinimumConfig + public required Dictionary GroupedWithProratedMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_prorated_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "grouped_with_prorated_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) - ?? throw new System::ArgumentNullException("grouped_with_prorated_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("grouped_with_prorated_minimum_config"); } set { this.Properties["grouped_with_prorated_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -262,20 +227,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -283,43 +249,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -328,115 +291,98 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required GroupedWithProratedMinimumProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required GroupedWithProratedMinimumProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("price_type"); + ) ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -447,18 +393,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -468,19 +411,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -512,7 +454,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -520,18 +461,23 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public GroupedWithProratedMinimum() { } + public GroupedWithProratedMinimum() + { + this.ModelType = JsonSerializer.Deserialize( + "\"grouped_with_prorated_minimum\"" + ); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - GroupedWithProratedMinimum(Generic::Dictionary properties) + [SetsRequiredMembers] + GroupedWithProratedMinimum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static GroupedWithProratedMinimum FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/Cadence.cs b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/Cadence.cs index 767e02fe..f9e4fcd0 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfig.cs index 57c0fdd7..787a18fa 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfigVariants/All.cs index f16ff25f..eed18d1d 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using GroupedWithProratedMinimumProperties = Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : GroupedWithProratedMinimumProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : GroupedWithProratedMinimumProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ModelType.cs b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ModelType.cs deleted file mode 100644 index 131cfeae..00000000 --- a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/ModelType.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType GroupedWithProratedMinimum = new( - "grouped_with_prorated_minimum" - ); - - readonly string _value = value; - - public enum Value - { - GroupedWithProratedMinimum, - } - - public Value Known() => - _value switch - { - "grouped_with_prorated_minimum" => Value.GroupedWithProratedMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/PriceType.cs b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/PriceType.cs index 307604d8..b850031b 100644 --- a/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/GroupedWithProratedMinimumProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.GroupedWithProratedMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/Matrix.cs b/src/Orb/Models/PriceProperties/Matrix.cs index 55bb6f4e..5b2fbfb1 100644 --- a/src/Orb/Models/PriceProperties/Matrix.cs +++ b/src/Orb/Models/PriceProperties/Matrix.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MatrixProperties = Orb.Models.PriceProperties.MatrixProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Matrix : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Matrix : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,128 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required MatrixProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +197,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,59 +219,53 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::MatrixConfig MatrixConfig { get { - if (!this.Properties.TryGetValue("matrix_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "matrix_config", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("matrix_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("matrix_config", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("matrix_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("matrix_config"); } - set { this.Properties["matrix_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_config"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -314,113 +274,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required MatrixProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required MatrixProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -431,18 +375,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -452,19 +393,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -493,7 +433,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -501,17 +440,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public Matrix() { } + public Matrix() + { + this.ModelType = JsonSerializer.Deserialize("\"matrix\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Matrix(Generic::Dictionary properties) + [SetsRequiredMembers] + Matrix(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Matrix FromRawUnchecked(Generic::Dictionary properties) + public static Matrix FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/MatrixProperties/Cadence.cs b/src/Orb/Models/PriceProperties/MatrixProperties/Cadence.cs index 0940ca53..a553e25a 100644 --- a/src/Orb/Models/PriceProperties/MatrixProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/MatrixProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfig.cs index a407b509..e67741bd 100644 --- a/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.MatrixProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfigVariants/All.cs index 8a3b0b55..a44951c3 100644 --- a/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/MatrixProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using MatrixProperties = Orb.Models.PriceProperties.MatrixProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : MatrixProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : MatrixProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/MatrixProperties/ModelType.cs b/src/Orb/Models/PriceProperties/MatrixProperties/ModelType.cs deleted file mode 100644 index e4630d3a..00000000 --- a/src/Orb/Models/PriceProperties/MatrixProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.MatrixProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType Matrix = new("matrix"); - - readonly string _value = value; - - public enum Value - { - Matrix, - } - - public Value Known() => - _value switch - { - "matrix" => Value.Matrix, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/MatrixProperties/PriceType.cs b/src/Orb/Models/PriceProperties/MatrixProperties/PriceType.cs index ccc22cc2..3271d37e 100644 --- a/src/Orb/Models/PriceProperties/MatrixProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/MatrixProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MatrixWithAllocation.cs b/src/Orb/Models/PriceProperties/MatrixWithAllocation.cs index c0d2c3e6..24722651 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithAllocation.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithAllocation.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MatrixWithAllocationProperties = Orb.Models.PriceProperties.MatrixWithAllocationProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MatrixWithAllocation - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MatrixWithAllocation : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required MatrixWithAllocationProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,13 +221,13 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::MatrixWithAllocationConfig MatrixWithAllocationConfig @@ -272,21 +237,22 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "matrix_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "matrix_with_allocation_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("matrix_with_allocation_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("matrix_with_allocation_config"); } set { - this.Properties["matrix_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -294,30 +260,27 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -326,115 +289,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required MatrixWithAllocationProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required MatrixWithAllocationProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -445,18 +390,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -466,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -507,7 +448,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -515,19 +455,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public MatrixWithAllocation() { } + public MatrixWithAllocation() + { + this.ModelType = JsonSerializer.Deserialize("\"matrix_with_allocation\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MatrixWithAllocation(Generic::Dictionary properties) + [SetsRequiredMembers] + MatrixWithAllocation(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MatrixWithAllocation FromRawUnchecked( - Generic::Dictionary properties - ) + public static MatrixWithAllocation FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/Cadence.cs b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/Cadence.cs index 83ea6381..a42e8f90 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfig.cs index 047b18b7..45ebeee1 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.MatrixWithAllocationProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfigVariants/All.cs index f59ea313..9e404cbf 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using MatrixWithAllocationProperties = Orb.Models.PriceProperties.MatrixWithAllocationProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithAllocationProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : MatrixWithAllocationProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : MatrixWithAllocationProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ModelType.cs b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ModelType.cs deleted file mode 100644 index 4b98b467..00000000 --- a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.MatrixWithAllocationProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType MatrixWithAllocation = new("matrix_with_allocation"); - - readonly string _value = value; - - public enum Value - { - MatrixWithAllocation, - } - - public Value Known() => - _value switch - { - "matrix_with_allocation" => Value.MatrixWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/PriceType.cs b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/PriceType.cs index 9993c7dc..238831b4 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithAllocationProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MatrixWithDisplayName.cs b/src/Orb/Models/PriceProperties/MatrixWithDisplayName.cs index 2d7a262c..3a69d900 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithDisplayName.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithDisplayName.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MatrixWithDisplayNameProperties = Orb.Models.PriceProperties.MatrixWithDisplayNameProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MatrixWithDisplayName - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MatrixWithDisplayName : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required MatrixWithDisplayNameProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,38 +221,38 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MatrixWithDisplayNameConfig + public required Dictionary MatrixWithDisplayNameConfig { get { if ( !this.Properties.TryGetValue( "matrix_with_display_name_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "matrix_with_display_name_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("matrix_with_display_name_config"); } set { - this.Properties["matrix_with_display_name_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_display_name_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -295,30 +260,27 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,115 +289,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required MatrixWithDisplayNameProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required MatrixWithDisplayNameProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -446,18 +390,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -511,7 +451,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public MatrixWithDisplayName() { } + public MatrixWithDisplayName() + { + this.ModelType = JsonSerializer.Deserialize("\"matrix_with_display_name\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MatrixWithDisplayName(Generic::Dictionary properties) + [SetsRequiredMembers] + MatrixWithDisplayName(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MatrixWithDisplayName FromRawUnchecked( - Generic::Dictionary properties - ) + public static MatrixWithDisplayName FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/Cadence.cs b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/Cadence.cs index 61c9a5e4..2faae239 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithDisplayNameProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfig.cs index e4cfe1c6..db5bfaec 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.MatrixWithDisplayNameProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithDisplayNameProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfigVariants/All.cs index 9a401a8f..a7f652a5 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using MatrixWithDisplayNameProperties = Orb.Models.PriceProperties.MatrixWithDisplayNameProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithDisplayNameProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : MatrixWithDisplayNameProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : MatrixWithDisplayNameProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ModelType.cs b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ModelType.cs deleted file mode 100644 index cd32ab4d..00000000 --- a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.MatrixWithDisplayNameProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType MatrixWithDisplayName = new("matrix_with_display_name"); - - readonly string _value = value; - - public enum Value - { - MatrixWithDisplayName, - } - - public Value Known() => - _value switch - { - "matrix_with_display_name" => Value.MatrixWithDisplayName, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/PriceType.cs b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/PriceType.cs index 6cd6c8a7..5e137bab 100644 --- a/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/MatrixWithDisplayNameProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MatrixWithDisplayNameProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MaxGroupTieredPackage.cs b/src/Orb/Models/PriceProperties/MaxGroupTieredPackage.cs index fb251eec..42ca92d0 100644 --- a/src/Orb/Models/PriceProperties/MaxGroupTieredPackage.cs +++ b/src/Orb/Models/PriceProperties/MaxGroupTieredPackage.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using MaxGroupTieredPackageProperties = Orb.Models.PriceProperties.MaxGroupTieredPackageProperties; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MaxGroupTieredPackage - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MaxGroupTieredPackage : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required MaxGroupTieredPackageProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,38 +221,38 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MaxGroupTieredPackageConfig + public required Dictionary MaxGroupTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "max_group_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "max_group_tiered_package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("max_group_tiered_package_config"); } set { - this.Properties["max_group_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["max_group_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -295,30 +260,27 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,115 +289,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required MaxGroupTieredPackageProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required MaxGroupTieredPackageProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -446,18 +390,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -511,7 +451,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public MaxGroupTieredPackage() { } + public MaxGroupTieredPackage() + { + this.ModelType = JsonSerializer.Deserialize("\"max_group_tiered_package\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MaxGroupTieredPackage(Generic::Dictionary properties) + [SetsRequiredMembers] + MaxGroupTieredPackage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MaxGroupTieredPackage FromRawUnchecked( - Generic::Dictionary properties - ) + public static MaxGroupTieredPackage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/Cadence.cs b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/Cadence.cs index 24586cb9..57ad2b0f 100644 --- a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MaxGroupTieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfig.cs index 47c5fc1b..21fa8bc0 100644 --- a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.MaxGroupTieredPackageProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MaxGroupTieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfigVariants/All.cs index 2663ead5..fbfcab3c 100644 --- a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using MaxGroupTieredPackageProperties = Orb.Models.PriceProperties.MaxGroupTieredPackageProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MaxGroupTieredPackageProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : MaxGroupTieredPackageProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : MaxGroupTieredPackageProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ModelType.cs b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ModelType.cs deleted file mode 100644 index 091424d8..00000000 --- a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.MaxGroupTieredPackageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType MaxGroupTieredPackage = new("max_group_tiered_package"); - - readonly string _value = value; - - public enum Value - { - MaxGroupTieredPackage, - } - - public Value Known() => - _value switch - { - "max_group_tiered_package" => Value.MaxGroupTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/PriceType.cs b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/PriceType.cs index faf0f766..8615c862 100644 --- a/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/MaxGroupTieredPackageProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.MaxGroupTieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/Package.cs b/src/Orb/Models/PriceProperties/Package.cs index 76acf22d..6b7ac575 100644 --- a/src/Orb/Models/PriceProperties/Package.cs +++ b/src/Orb/Models/PriceProperties/Package.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; using PackageProperties = Orb.Models.PriceProperties.PackageProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Package : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Package : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,128 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required PackageProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +197,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +219,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,129 +261,113 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required PackageProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required Models::PackageConfig PackageConfig { get { - if (!this.Properties.TryGetValue("package_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("package_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("package_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("package_config"); } - set { this.Properties["package_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["package_config"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required PackageProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -431,18 +378,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -452,19 +396,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -492,7 +435,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; this.PackageConfig.Validate(); _ = this.PlanPhaseOrder; @@ -501,19 +443,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public Package() { } + public Package() + { + this.ModelType = JsonSerializer.Deserialize("\"package\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Package(Generic::Dictionary properties) + [SetsRequiredMembers] + Package(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Package FromRawUnchecked( - Generic::Dictionary properties - ) + public static Package FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/PackageProperties/Cadence.cs b/src/Orb/Models/PriceProperties/PackageProperties/Cadence.cs index 5031eb9f..109b9853 100644 --- a/src/Orb/Models/PriceProperties/PackageProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/PackageProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfig.cs index 4243edfa..1ad680cf 100644 --- a/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.PackageProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfigVariants/All.cs index e7bfb3c5..9864f304 100644 --- a/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/PackageProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using PackageProperties = Orb.Models.PriceProperties.PackageProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : PackageProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : PackageProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/PackageProperties/ModelType.cs b/src/Orb/Models/PriceProperties/PackageProperties/ModelType.cs deleted file mode 100644 index 18685d7e..00000000 --- a/src/Orb/Models/PriceProperties/PackageProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.PackageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType Package = new("package"); - - readonly string _value = value; - - public enum Value - { - Package, - } - - public Value Known() => - _value switch - { - "package" => Value.Package, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/PackageProperties/PriceType.cs b/src/Orb/Models/PriceProperties/PackageProperties/PriceType.cs index dc147d89..024a135c 100644 --- a/src/Orb/Models/PriceProperties/PackageProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/PackageProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/PackageWithAllocation.cs b/src/Orb/Models/PriceProperties/PackageWithAllocation.cs index e3f6832c..3b5c1c28 100644 --- a/src/Orb/Models/PriceProperties/PackageWithAllocation.cs +++ b/src/Orb/Models/PriceProperties/PackageWithAllocation.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; using PackageWithAllocationProperties = Orb.Models.PriceProperties.PackageWithAllocationProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PackageWithAllocation - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PackageWithAllocation : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required PackageWithAllocationProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -301,105 +263,94 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required PackageWithAllocationProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary PackageWithAllocationConfig + public required Dictionary PackageWithAllocationConfig { get { if ( !this.Properties.TryGetValue( "package_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "package_with_allocation_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("package_with_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("package_with_allocation_config"); } set { - this.Properties["package_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["package_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -407,35 +358,28 @@ public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required PackageWithAllocationProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -446,18 +390,15 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -507,7 +447,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; foreach (var item in this.PackageWithAllocationConfig.Values) { @@ -519,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public PackageWithAllocation() { } + public PackageWithAllocation() + { + this.ModelType = JsonSerializer.Deserialize("\"package_with_allocation\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PackageWithAllocation(Generic::Dictionary properties) + [SetsRequiredMembers] + PackageWithAllocation(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PackageWithAllocation FromRawUnchecked( - Generic::Dictionary properties - ) + public static PackageWithAllocation FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/Cadence.cs b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/Cadence.cs index b838304a..eda00bf6 100644 --- a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageWithAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfig.cs index 97d80934..35b71b57 100644 --- a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.PackageWithAllocationProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageWithAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfigVariants/All.cs index b636061b..99decbcf 100644 --- a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using PackageWithAllocationProperties = Orb.Models.PriceProperties.PackageWithAllocationProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageWithAllocationProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : PackageWithAllocationProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : PackageWithAllocationProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ModelType.cs b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ModelType.cs deleted file mode 100644 index 8f352d0b..00000000 --- a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.PackageWithAllocationProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType PackageWithAllocation = new("package_with_allocation"); - - readonly string _value = value; - - public enum Value - { - PackageWithAllocation, - } - - public Value Known() => - _value switch - { - "package_with_allocation" => Value.PackageWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/PriceType.cs b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/PriceType.cs index c5720217..2cb42145 100644 --- a/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/PackageWithAllocationProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.PackageWithAllocationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricing.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricing.cs index abeea9ae..20ac7c22 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricing.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricing.cs @@ -1,45 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; using ScalableMatrixWithTieredPricingProperties = Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class ScalableMatrixWithTieredPricing - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +46,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +68,131 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("cadence"); + ) ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required ScalableMatrixWithTieredPricingProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +202,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,43 +224,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -301,115 +266,98 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required ScalableMatrixWithTieredPricingProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required ScalableMatrixWithTieredPricingProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("price_type"); + ) ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -420,49 +368,39 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithTieredPricingConfig + public required Dictionary ScalableMatrixWithTieredPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_tiered_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "scalable_matrix_with_tiered_pricing_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) - ?? throw new System::ArgumentNullException( - "scalable_matrix_with_tiered_pricing_config" - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("scalable_matrix_with_tiered_pricing_config"); } set { this.Properties["scalable_matrix_with_tiered_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -473,19 +411,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -513,7 +450,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -525,18 +461,23 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public ScalableMatrixWithTieredPricing() { } + public ScalableMatrixWithTieredPricing() + { + this.ModelType = JsonSerializer.Deserialize( + "\"scalable_matrix_with_tiered_pricing\"" + ); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ScalableMatrixWithTieredPricing(Generic::Dictionary properties) + [SetsRequiredMembers] + ScalableMatrixWithTieredPricing(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ScalableMatrixWithTieredPricing FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/Cadence.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/Cadence.cs index 83b0b9a5..7d7ebd16 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfig.cs index 1fe2fef8..b47e68b2 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfigVariants/All.cs index d7fd7a2e..de9a4738 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ScalableMatrixWithTieredPricingProperties = Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : ScalableMatrixWithTieredPricingProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : ScalableMatrixWithTieredPricingProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ModelType.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ModelType.cs deleted file mode 100644 index 31c19527..00000000 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/ModelType.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType ScalableMatrixWithTieredPricing = new( - "scalable_matrix_with_tiered_pricing" - ); - - readonly string _value = value; - - public enum Value - { - ScalableMatrixWithTieredPricing, - } - - public Value Known() => - _value switch - { - "scalable_matrix_with_tiered_pricing" => Value.ScalableMatrixWithTieredPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/PriceType.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/PriceType.cs index 7fcebd0f..7759e2d5 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithTieredPricingProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithTieredPricingProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricing.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricing.cs index 97b346bd..b105b749 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricing.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricing.cs @@ -1,45 +1,44 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; using ScalableMatrixWithUnitPricingProperties = Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class ScalableMatrixWithUnitPricing - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +46,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +68,131 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("cadence"); + ) ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required ScalableMatrixWithUnitPricingProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +202,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,43 +224,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -301,115 +266,98 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required ScalableMatrixWithUnitPricingProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required ScalableMatrixWithUnitPricingProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("price_type"); + ) ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -420,49 +368,39 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithUnitPricingConfig + public required Dictionary ScalableMatrixWithUnitPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_unit_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "scalable_matrix_with_unit_pricing_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) - ?? throw new System::ArgumentNullException( - "scalable_matrix_with_unit_pricing_config" - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("scalable_matrix_with_unit_pricing_config"); } set { this.Properties["scalable_matrix_with_unit_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -473,19 +411,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -513,7 +450,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -525,18 +461,23 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public ScalableMatrixWithUnitPricing() { } + public ScalableMatrixWithUnitPricing() + { + this.ModelType = JsonSerializer.Deserialize( + "\"scalable_matrix_with_unit_pricing\"" + ); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ScalableMatrixWithUnitPricing(Generic::Dictionary properties) + [SetsRequiredMembers] + ScalableMatrixWithUnitPricing(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static ScalableMatrixWithUnitPricing FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/Cadence.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/Cadence.cs index 17ff67ba..f110d9d0 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfig.cs index 7ccdd530..ab66b24b 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfigVariants/All.cs index f5287d31..9f73bbfb 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ScalableMatrixWithUnitPricingProperties = Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : ScalableMatrixWithUnitPricingProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : ScalableMatrixWithUnitPricingProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ModelType.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ModelType.cs deleted file mode 100644 index 8ca4bf84..00000000 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/ModelType.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType ScalableMatrixWithUnitPricing = new( - "scalable_matrix_with_unit_pricing" - ); - - readonly string _value = value; - - public enum Value - { - ScalableMatrixWithUnitPricing, - } - - public Value Known() => - _value switch - { - "scalable_matrix_with_unit_pricing" => Value.ScalableMatrixWithUnitPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/PriceType.cs b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/PriceType.cs index 80c3d7a0..d52efa77 100644 --- a/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/ScalableMatrixWithUnitPricingProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ScalableMatrixWithUnitPricingProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/ThresholdTotalAmount.cs b/src/Orb/Models/PriceProperties/ThresholdTotalAmount.cs index d2528c34..833e5d8a 100644 --- a/src/Orb/Models/PriceProperties/ThresholdTotalAmount.cs +++ b/src/Orb/Models/PriceProperties/ThresholdTotalAmount.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using ThresholdTotalAmountProperties = Orb.Models.PriceProperties.ThresholdTotalAmountProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ThresholdTotalAmount - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ThresholdTotalAmount : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required ThresholdTotalAmountProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -301,115 +263,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required ThresholdTotalAmountProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required ThresholdTotalAmountProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -420,43 +364,40 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary ThresholdTotalAmountConfig + public required Dictionary ThresholdTotalAmountConfig { get { if ( !this.Properties.TryGetValue( "threshold_total_amount_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "threshold_total_amount_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("threshold_total_amount_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("threshold_total_amount_config"); } set { - this.Properties["threshold_total_amount_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["threshold_total_amount_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -507,7 +447,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public ThresholdTotalAmount() { } + public ThresholdTotalAmount() + { + this.ModelType = JsonSerializer.Deserialize("\"threshold_total_amount\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ThresholdTotalAmount(Generic::Dictionary properties) + [SetsRequiredMembers] + ThresholdTotalAmount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ThresholdTotalAmount FromRawUnchecked( - Generic::Dictionary properties - ) + public static ThresholdTotalAmount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/Cadence.cs b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/Cadence.cs index 01a29cb8..c72ad9ec 100644 --- a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ThresholdTotalAmountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfig.cs index 4cf3e6d5..26f47771 100644 --- a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.ThresholdTotalAmountProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ThresholdTotalAmountProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfigVariants/All.cs index ef5ac885..79ee3854 100644 --- a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using ThresholdTotalAmountProperties = Orb.Models.PriceProperties.ThresholdTotalAmountProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ThresholdTotalAmountProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : ThresholdTotalAmountProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : ThresholdTotalAmountProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ModelType.cs b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ModelType.cs deleted file mode 100644 index 4ccf6ef8..00000000 --- a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.ThresholdTotalAmountProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType ThresholdTotalAmount = new("threshold_total_amount"); - - readonly string _value = value; - - public enum Value - { - ThresholdTotalAmount, - } - - public Value Known() => - _value switch - { - "threshold_total_amount" => Value.ThresholdTotalAmount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/PriceType.cs b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/PriceType.cs index 8888e15b..8aa5cb34 100644 --- a/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/ThresholdTotalAmountProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.ThresholdTotalAmountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/Tiered.cs b/src/Orb/Models/PriceProperties/Tiered.cs index 61acae33..c07d7276 100644 --- a/src/Orb/Models/PriceProperties/Tiered.cs +++ b/src/Orb/Models/PriceProperties/Tiered.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TieredProperties = Orb.Models.PriceProperties.TieredProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Tiered : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Tiered : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,128 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required TieredProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +197,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +219,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,113 +261,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required TieredProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required TieredProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -415,34 +362,28 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public required Models::TieredConfig TieredConfig { get { - if (!this.Properties.TryGetValue("tiered_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "tiered_config", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("tiered_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("tiered_config", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("tiered_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("tiered_config"); } - set { this.Properties["tiered_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiered_config"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -452,19 +393,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -492,7 +432,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -501,17 +440,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public Tiered() { } + public Tiered() + { + this.ModelType = JsonSerializer.Deserialize("\"tiered\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Tiered(Generic::Dictionary properties) + [SetsRequiredMembers] + Tiered(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Tiered FromRawUnchecked(Generic::Dictionary properties) + public static Tiered FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/TieredBPS.cs b/src/Orb/Models/PriceProperties/TieredBPS.cs index cd46ebe0..f128c7af 100644 --- a/src/Orb/Models/PriceProperties/TieredBPS.cs +++ b/src/Orb/Models/PriceProperties/TieredBPS.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TieredBPSProperties = Orb.Models.PriceProperties.TieredBPSProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredBPS : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredBPS : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,128 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required TieredBPSProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +197,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +219,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,113 +261,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required TieredBPSProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required TieredBPSProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -415,37 +362,31 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public required Models::TieredBPSConfig TieredBPSConfig { get { - if (!this.Properties.TryGetValue("tiered_bps_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("tiered_bps_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "tiered_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("tiered_bps_config"); - } - set - { - this.Properties["tiered_bps_config"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("tiered_bps_config"); } + set { this.Properties["tiered_bps_config"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -455,19 +396,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -495,7 +435,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -504,19 +443,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public TieredBPS() { } + public TieredBPS() + { + this.ModelType = JsonSerializer.Deserialize("\"tiered_bps\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredBPS(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredBPS(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TieredBPS FromRawUnchecked( - Generic::Dictionary properties - ) + public static TieredBPS FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/TieredBPSProperties/Cadence.cs b/src/Orb/Models/PriceProperties/TieredBPSProperties/Cadence.cs index 06836325..d0aaeb65 100644 --- a/src/Orb/Models/PriceProperties/TieredBPSProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/TieredBPSProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredBPSProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfig.cs index 3cd3d281..ccfa6d6f 100644 --- a/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.TieredBPSProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredBPSProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfigVariants/All.cs index 19983c56..cc7331e3 100644 --- a/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/TieredBPSProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using TieredBPSProperties = Orb.Models.PriceProperties.TieredBPSProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredBPSProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : TieredBPSProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : TieredBPSProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/TieredBPSProperties/ModelType.cs b/src/Orb/Models/PriceProperties/TieredBPSProperties/ModelType.cs deleted file mode 100644 index ea58220b..00000000 --- a/src/Orb/Models/PriceProperties/TieredBPSProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.TieredBPSProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType TieredBPS = new("tiered_bps"); - - readonly string _value = value; - - public enum Value - { - TieredBPS, - } - - public Value Known() => - _value switch - { - "tiered_bps" => Value.TieredBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/TieredBPSProperties/PriceType.cs b/src/Orb/Models/PriceProperties/TieredBPSProperties/PriceType.cs index 0a90a14a..5fe60392 100644 --- a/src/Orb/Models/PriceProperties/TieredBPSProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/TieredBPSProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredBPSProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredPackage.cs b/src/Orb/Models/PriceProperties/TieredPackage.cs index d3f86789..fc90a60f 100644 --- a/src/Orb/Models/PriceProperties/TieredPackage.cs +++ b/src/Orb/Models/PriceProperties/TieredPackage.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TieredPackageProperties = Orb.Models.PriceProperties.TieredPackageProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredPackage : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredPackage : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required TieredPackageProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,113 +263,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required TieredPackageProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required TieredPackageProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -415,42 +364,31 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageConfig + public required Dictionary TieredPackageConfig { get { - if ( - !this.Properties.TryGetValue("tiered_package_config", out Json::JsonElement element) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("tiered_package_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "tiered_package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_config"); - } - set - { - this.Properties["tiered_package_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("tiered_package_config"); } + set { this.Properties["tiered_package_config"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -460,19 +398,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -500,7 +437,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -512,19 +448,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public TieredPackage() { } + public TieredPackage() + { + this.ModelType = JsonSerializer.Deserialize("\"tiered_package\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredPackage(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredPackage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TieredPackage FromRawUnchecked( - Generic::Dictionary properties - ) + public static TieredPackage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/TieredPackageProperties/Cadence.cs b/src/Orb/Models/PriceProperties/TieredPackageProperties/Cadence.cs index 2eeadfbf..6106bf73 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfig.cs index 85ecd4a2..6348be10 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.TieredPackageProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfigVariants/All.cs index 6e11f048..3aaa15b0 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using TieredPackageProperties = Orb.Models.PriceProperties.TieredPackageProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : TieredPackageProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : TieredPackageProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/TieredPackageProperties/ModelType.cs b/src/Orb/Models/PriceProperties/TieredPackageProperties/ModelType.cs deleted file mode 100644 index f211e86e..00000000 --- a/src/Orb/Models/PriceProperties/TieredPackageProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.TieredPackageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType TieredPackage = new("tiered_package"); - - readonly string _value = value; - - public enum Value - { - TieredPackage, - } - - public Value Known() => - _value switch - { - "tiered_package" => Value.TieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/TieredPackageProperties/PriceType.cs b/src/Orb/Models/PriceProperties/TieredPackageProperties/PriceType.cs index 99443dae..202769c0 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredPackageWithMinimum.cs b/src/Orb/Models/PriceProperties/TieredPackageWithMinimum.cs index 594fa016..29620dbd 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageWithMinimum.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageWithMinimum.cs @@ -1,45 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TieredPackageWithMinimumProperties = Orb.Models.PriceProperties.TieredPackageWithMinimumProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredPackageWithMinimum - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredPackageWithMinimum : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -47,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,161 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required TieredPackageWithMinimumProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -235,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -256,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -301,115 +263,98 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required TieredPackageWithMinimumProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required TieredPackageWithMinimumProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("price_type"); + ) ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -420,43 +365,39 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageWithMinimumConfig + public required Dictionary TieredPackageWithMinimumConfig { get { if ( !this.Properties.TryGetValue( "tiered_package_with_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "tiered_package_with_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("tiered_package_with_minimum_config"); } set { this.Properties["tiered_package_with_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -467,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -507,7 +447,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -519,18 +458,21 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public TieredPackageWithMinimum() { } + public TieredPackageWithMinimum() + { + this.ModelType = JsonSerializer.Deserialize("\"tiered_package_with_minimum\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredPackageWithMinimum(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredPackageWithMinimum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static TieredPackageWithMinimum FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/Cadence.cs b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/Cadence.cs index ebdd3b86..593db65f 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageWithMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfig.cs index 9e788737..251dae7f 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.TieredPackageWithMinimumProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageWithMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfigVariants/All.cs index 003ad8e6..afcee008 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using TieredPackageWithMinimumProperties = Orb.Models.PriceProperties.TieredPackageWithMinimumProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageWithMinimumProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : TieredPackageWithMinimumProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : TieredPackageWithMinimumProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ModelType.cs b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ModelType.cs deleted file mode 100644 index e3e6e578..00000000 --- a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.TieredPackageWithMinimumProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType TieredPackageWithMinimum = new("tiered_package_with_minimum"); - - readonly string _value = value; - - public enum Value - { - TieredPackageWithMinimum, - } - - public Value Known() => - _value switch - { - "tiered_package_with_minimum" => Value.TieredPackageWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/PriceType.cs b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/PriceType.cs index 9e80e0e7..b0f41d2f 100644 --- a/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/TieredPackageWithMinimumProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredPackageWithMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredProperties/Cadence.cs b/src/Orb/Models/PriceProperties/TieredProperties/Cadence.cs index 0abea274..64730a43 100644 --- a/src/Orb/Models/PriceProperties/TieredProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/TieredProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfig.cs index ef1defbf..5902a325 100644 --- a/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.TieredProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfigVariants/All.cs index ff982904..122d8bc6 100644 --- a/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/TieredProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using TieredProperties = Orb.Models.PriceProperties.TieredProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : TieredProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : TieredProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/TieredProperties/ModelType.cs b/src/Orb/Models/PriceProperties/TieredProperties/ModelType.cs deleted file mode 100644 index 846cfadb..00000000 --- a/src/Orb/Models/PriceProperties/TieredProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.TieredProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType Tiered = new("tiered"); - - readonly string _value = value; - - public enum Value - { - Tiered, - } - - public Value Known() => - _value switch - { - "tiered" => Value.Tiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/TieredProperties/PriceType.cs b/src/Orb/Models/PriceProperties/TieredProperties/PriceType.cs index 1310c7b4..d0cf546a 100644 --- a/src/Orb/Models/PriceProperties/TieredProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/TieredProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredWithMinimum.cs b/src/Orb/Models/PriceProperties/TieredWithMinimum.cs index ca69b4c9..218f6f79 100644 --- a/src/Orb/Models/PriceProperties/TieredWithMinimum.cs +++ b/src/Orb/Models/PriceProperties/TieredWithMinimum.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TieredWithMinimumProperties = Orb.Models.PriceProperties.TieredWithMinimumProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredWithMinimum : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredWithMinimum : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required TieredWithMinimumProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,113 +263,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required TieredWithMinimumProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required TieredWithMinimumProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -415,42 +364,33 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithMinimumConfig + public required Dictionary TieredWithMinimumConfig { get { - if ( - !this.Properties.TryGetValue( - "tiered_with_minimum_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("tiered_with_minimum_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "tiered_with_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("tiered_with_minimum_config"); } set { - this.Properties["tiered_with_minimum_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["tiered_with_minimum_config"] = JsonSerializer.SerializeToElement( value ); } @@ -463,19 +403,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -503,7 +442,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -515,19 +453,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public TieredWithMinimum() { } + public TieredWithMinimum() + { + this.ModelType = JsonSerializer.Deserialize("\"tiered_with_minimum\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredWithMinimum(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredWithMinimum(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TieredWithMinimum FromRawUnchecked( - Generic::Dictionary properties - ) + public static TieredWithMinimum FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/Cadence.cs b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/Cadence.cs index 77290f59..c12889e3 100644 --- a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfig.cs index 6a9c157f..c501497d 100644 --- a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.TieredWithMinimumProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfigVariants/All.cs index 40f4537b..8418727d 100644 --- a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using TieredWithMinimumProperties = Orb.Models.PriceProperties.TieredWithMinimumProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithMinimumProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : TieredWithMinimumProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : TieredWithMinimumProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ModelType.cs b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ModelType.cs deleted file mode 100644 index 7eebbe88..00000000 --- a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.TieredWithMinimumProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType TieredWithMinimum = new("tiered_with_minimum"); - - readonly string _value = value; - - public enum Value - { - TieredWithMinimum, - } - - public Value Known() => - _value switch - { - "tiered_with_minimum" => Value.TieredWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/PriceType.cs b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/PriceType.cs index 47e4a6ce..f9269c0c 100644 --- a/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/TieredWithMinimumProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithMinimumProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredWithProration.cs b/src/Orb/Models/PriceProperties/TieredWithProration.cs index 9613ef4b..b63f2492 100644 --- a/src/Orb/Models/PriceProperties/TieredWithProration.cs +++ b/src/Orb/Models/PriceProperties/TieredWithProration.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using TieredWithProrationProperties = Orb.Models.PriceProperties.TieredWithProrationProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredWithProration : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredWithProration : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required TieredWithProrationProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,115 +263,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required TieredWithProrationProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required TieredWithProrationProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -417,43 +364,40 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithProrationConfig + public required Dictionary TieredWithProrationConfig { get { if ( !this.Properties.TryGetValue( "tiered_with_proration_config", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "tiered_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("tiered_with_proration_config"); } set { - this.Properties["tiered_with_proration_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["tiered_with_proration_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -464,19 +408,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -504,7 +447,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -516,19 +458,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public TieredWithProration() { } + public TieredWithProration() + { + this.ModelType = JsonSerializer.Deserialize("\"tiered_with_proration\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredWithProration(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredWithProration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TieredWithProration FromRawUnchecked( - Generic::Dictionary properties - ) + public static TieredWithProration FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/Cadence.cs b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/Cadence.cs index c5040cc4..05f6cb81 100644 --- a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfig.cs index eb14b5e4..384272ca 100644 --- a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.TieredWithProrationProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfigVariants/All.cs index e89a2045..6c83d1a9 100644 --- a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using TieredWithProrationProperties = Orb.Models.PriceProperties.TieredWithProrationProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithProrationProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : TieredWithProrationProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : TieredWithProrationProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ModelType.cs b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ModelType.cs deleted file mode 100644 index 1c7a1181..00000000 --- a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.TieredWithProrationProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType TieredWithProration = new("tiered_with_proration"); - - readonly string _value = value; - - public enum Value - { - TieredWithProration, - } - - public Value Known() => - _value switch - { - "tiered_with_proration" => Value.TieredWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/PriceType.cs b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/PriceType.cs index e6cb2d2b..bf16d65c 100644 --- a/src/Orb/Models/PriceProperties/TieredWithProrationProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/TieredWithProrationProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.TieredWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/Unit.cs b/src/Orb/Models/PriceProperties/Unit.cs index 01abd024..1ed9fbc0 100644 --- a/src/Orb/Models/PriceProperties/Unit.cs +++ b/src/Orb/Models/PriceProperties/Unit.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using UnitProperties = Orb.Models.PriceProperties.UnitProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Unit : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Unit : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,158 +66,128 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required UnitProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -230,20 +197,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -251,43 +219,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -296,113 +261,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required UnitProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required UnitProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -413,34 +362,28 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } public required Models::UnitConfig UnitConfig { get { - if (!this.Properties.TryGetValue("unit_config", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "unit_config", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("unit_config", out JsonElement element)) + throw new ArgumentOutOfRangeException("unit_config", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("unit_config"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("unit_config"); } - set { this.Properties["unit_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_config"] = JsonSerializer.SerializeToElement(value); } } public Models::DimensionalPriceConfiguration? DimensionalPriceConfiguration @@ -450,19 +393,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -490,7 +432,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -499,17 +440,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public Unit() { } + public Unit() + { + this.ModelType = JsonSerializer.Deserialize("\"unit\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Unit(Generic::Dictionary properties) + [SetsRequiredMembers] + Unit(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Unit FromRawUnchecked(Generic::Dictionary properties) + public static Unit FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/UnitProperties/Cadence.cs b/src/Orb/Models/PriceProperties/UnitProperties/Cadence.cs index 4d9ab51e..20c26595 100644 --- a/src/Orb/Models/PriceProperties/UnitProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/UnitProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfig.cs index 8e155e6a..b0d72ca3 100644 --- a/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.UnitProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfigVariants/All.cs index b9f1eade..cf50e13f 100644 --- a/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/UnitProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using UnitProperties = Orb.Models.PriceProperties.UnitProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : UnitProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : UnitProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/UnitProperties/ModelType.cs b/src/Orb/Models/PriceProperties/UnitProperties/ModelType.cs deleted file mode 100644 index 85d8eaab..00000000 --- a/src/Orb/Models/PriceProperties/UnitProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.UnitProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType Unit = new("unit"); - - readonly string _value = value; - - public enum Value - { - Unit, - } - - public Value Known() => - _value switch - { - "unit" => Value.Unit, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/UnitProperties/PriceType.cs b/src/Orb/Models/PriceProperties/UnitProperties/PriceType.cs index 23243e33..aebe6093 100644 --- a/src/Orb/Models/PriceProperties/UnitProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/UnitProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/UnitWithPercent.cs b/src/Orb/Models/PriceProperties/UnitWithPercent.cs index 31848f63..3bf9361a 100644 --- a/src/Orb/Models/PriceProperties/UnitWithPercent.cs +++ b/src/Orb/Models/PriceProperties/UnitWithPercent.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using UnitWithPercentProperties = Orb.Models.PriceProperties.UnitWithPercentProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class UnitWithPercent : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class UnitWithPercent : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required UnitWithPercentProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,113 +263,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required UnitWithPercentProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required UnitWithPercentProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -415,44 +364,33 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithPercentConfig + public required Dictionary UnitWithPercentConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_percent_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("unit_with_percent_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "unit_with_percent_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_percent_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("unit_with_percent_config"); } set { - this.Properties["unit_with_percent_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["unit_with_percent_config"] = JsonSerializer.SerializeToElement(value); } } @@ -463,19 +401,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -503,7 +440,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -515,19 +451,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public UnitWithPercent() { } + public UnitWithPercent() + { + this.ModelType = JsonSerializer.Deserialize("\"unit_with_percent\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UnitWithPercent(Generic::Dictionary properties) + [SetsRequiredMembers] + UnitWithPercent(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static UnitWithPercent FromRawUnchecked( - Generic::Dictionary properties - ) + public static UnitWithPercent FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/Cadence.cs b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/Cadence.cs index 7c4ee5de..00541ffd 100644 --- a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithPercentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfig.cs index fd56fa26..f160f505 100644 --- a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.UnitWithPercentProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithPercentProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfigVariants/All.cs index 486ae4fc..862b8ce5 100644 --- a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using UnitWithPercentProperties = Orb.Models.PriceProperties.UnitWithPercentProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithPercentProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : UnitWithPercentProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : UnitWithPercentProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ModelType.cs b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ModelType.cs deleted file mode 100644 index 2ab398bd..00000000 --- a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.UnitWithPercentProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType UnitWithPercent = new("unit_with_percent"); - - readonly string _value = value; - - public enum Value - { - UnitWithPercent, - } - - public Value Known() => - _value switch - { - "unit_with_percent" => Value.UnitWithPercent, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/PriceType.cs b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/PriceType.cs index adf5e46e..2ad3a891 100644 --- a/src/Orb/Models/PriceProperties/UnitWithPercentProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/UnitWithPercentProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithPercentProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/UnitWithProration.cs b/src/Orb/Models/PriceProperties/UnitWithProration.cs index 97447fff..404ee59f 100644 --- a/src/Orb/Models/PriceProperties/UnitWithProration.cs +++ b/src/Orb/Models/PriceProperties/UnitWithProration.cs @@ -1,43 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; using UnitWithProrationProperties = Orb.Models.PriceProperties.UnitWithProrationProperties; namespace Orb.Models.PriceProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class UnitWithProration : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class UnitWithProration : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillableMetricTiny? BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration BillingCycleConfiguration @@ -45,23 +44,21 @@ public required string ID get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billing_cycle_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_configuration"); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,160 +66,130 @@ public required string ID { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "cadence", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) + throw new ArgumentOutOfRangeException("cadence", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } public required double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } public required UnitWithProrationProperties::ConversionRateConfig? ConversionRateConfig { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "conversion_rate_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } public required Models::Allocation? CreditAllocation { get { - if (!this.Properties.TryGetValue("credit_allocation", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("credit_allocation", out JsonElement element)) + throw new ArgumentOutOfRangeException( "credit_allocation", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["credit_allocation"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["credit_allocation"] = JsonSerializer.SerializeToElement(value); } } public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } - public required Models::Discount? Discount + public required Models::Discount2? Discount { get { - if (!this.Properties.TryGetValue("discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount"] = JsonSerializer.SerializeToElement(value); } } public required string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException( "fixed_price_quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleConfiguration? InvoicingCycleConfiguration @@ -232,20 +199,21 @@ public required double? FixedPriceQuantity if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "invoicing_cycle_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -253,43 +221,40 @@ public required double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("item", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("item", "Missing required argument"); + if (!this.Properties.TryGetValue("item", out JsonElement element)) + throw new ArgumentOutOfRangeException("item", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("item"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("item"); } - set { this.Properties["item"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item"] = JsonSerializer.SerializeToElement(value); } } public required Models::Maximum? Maximum { get { - if (!this.Properties.TryGetValue("maximum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "maximum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("maximum", out JsonElement element)) + throw new ArgumentOutOfRangeException("maximum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum"] = JsonSerializer.SerializeToElement(value); } } public required string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -298,113 +263,97 @@ public required string? MaximumAmount /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } public required Models::Minimum? Minimum { get { - if (!this.Properties.TryGetValue("minimum", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "minimum", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("minimum", out JsonElement element)) + throw new ArgumentOutOfRangeException("minimum", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum"] = JsonSerializer.SerializeToElement(value); } } public required string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } - public required UnitWithProrationProperties::ModelType ModelType + public JsonElement ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "model_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("model_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } public required UnitWithProrationProperties::PriceType PriceType { get { - if (!this.Properties.TryGetValue("price_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("price_type"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("price_type"); } - set { this.Properties["price_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -415,42 +364,33 @@ public required string? ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithProrationConfig + public required Dictionary UnitWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_proration_config", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("unit_with_proration_config", out JsonElement element)) + throw new ArgumentOutOfRangeException( "unit_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("unit_with_proration_config"); } set { - this.Properties["unit_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["unit_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -463,19 +403,18 @@ public required string? ReplacesPriceID if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -503,7 +442,6 @@ public override void Validate() } this.Minimum?.Validate(); _ = this.MinimumAmount; - this.ModelType.Validate(); _ = this.Name; _ = this.PlanPhaseOrder; this.PriceType.Validate(); @@ -515,19 +453,20 @@ public override void Validate() this.DimensionalPriceConfiguration?.Validate(); } - public UnitWithProration() { } + public UnitWithProration() + { + this.ModelType = JsonSerializer.Deserialize("\"unit_with_proration\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UnitWithProration(Generic::Dictionary properties) + [SetsRequiredMembers] + UnitWithProration(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static UnitWithProration FromRawUnchecked( - Generic::Dictionary properties - ) + public static UnitWithProration FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/Cadence.cs b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/Cadence.cs index 13fda958..adcc92b9 100644 --- a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/Cadence.cs +++ b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/Cadence.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence OneTime = new("one_time"); @@ -40,7 +39,7 @@ public Value Known() => "semi_annual" => Value.SemiAnnual, "annual" => Value.Annual, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfig.cs b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfig.cs index b1277b12..2cf1735c 100644 --- a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfig.cs @@ -1,22 +1,18 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.PriceProperties.UnitWithProrationProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfigVariants/All.cs index 7ed5b917..ce2621ca 100644 --- a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using UnitWithProrationProperties = Orb.Models.PriceProperties.UnitWithProrationProperties; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithProrationProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : UnitWithProrationProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : UnitWithProrationProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ModelType.cs b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ModelType.cs deleted file mode 100644 index 76793b1f..00000000 --- a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/ModelType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.PriceProperties.UnitWithProrationProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum -{ - public static readonly ModelType UnitWithProration = new("unit_with_proration"); - - readonly string _value = value; - - public enum Value - { - UnitWithProration, - } - - public Value Known() => - _value switch - { - "unit_with_proration" => Value.UnitWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static ModelType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/PriceType.cs b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/PriceType.cs index 4cea6b5a..b53b51b9 100644 --- a/src/Orb/Models/PriceProperties/UnitWithProrationProperties/PriceType.cs +++ b/src/Orb/Models/PriceProperties/UnitWithProrationProperties/PriceType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.PriceProperties.UnitWithProrationProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class PriceType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class PriceType(string value) : IEnum { public static readonly PriceType UsagePrice = new("usage_price"); @@ -24,7 +23,7 @@ public Value Known() => { "usage_price" => Value.UsagePrice, "fixed_price" => Value.FixedPrice, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/PriceVariants/All.cs b/src/Orb/Models/PriceVariants/All.cs index 0e04b679..198472ea 100644 --- a/src/Orb/Models/PriceVariants/All.cs +++ b/src/Orb/Models/PriceVariants/All.cs @@ -1,14 +1,12 @@ -using Models = Orb.Models; -using Orb = Orb; +using System.Text.Json.Serialization; using PriceProperties = Orb.Models.PriceProperties; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.PriceVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Unit(PriceProperties::Unit Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static Unit From(PriceProperties::Unit value) { @@ -21,10 +19,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Package(PriceProperties::Package Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static Package From(PriceProperties::Package value) { @@ -37,10 +35,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Matrix(PriceProperties::Matrix Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static Matrix From(PriceProperties::Matrix value) { @@ -53,10 +51,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Tiered(PriceProperties::Tiered Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static Tiered From(PriceProperties::Tiered value) { @@ -69,10 +67,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class TieredBPS(PriceProperties::TieredBPS Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static TieredBPS From(PriceProperties::TieredBPS value) { @@ -85,10 +83,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class BPS(PriceProperties::BPS Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static BPS From(PriceProperties::BPS value) { @@ -101,10 +99,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class BulkBPS(PriceProperties::BulkBPS Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static BulkBPS From(PriceProperties::BulkBPS value) { @@ -117,10 +115,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Bulk(PriceProperties::Bulk Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static Bulk From(PriceProperties::Bulk value) { @@ -133,12 +131,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class ThresholdTotalAmount(PriceProperties::ThresholdTotalAmount Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static ThresholdTotalAmount From(PriceProperties::ThresholdTotalAmount value) { @@ -151,12 +149,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class TieredPackage(PriceProperties::TieredPackage Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static TieredPackage From(PriceProperties::TieredPackage value) { @@ -169,12 +165,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class GroupedTiered(PriceProperties::GroupedTiered Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static GroupedTiered From(PriceProperties::GroupedTiered value) { @@ -187,12 +181,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class TieredWithMinimum(PriceProperties::TieredWithMinimum Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static TieredWithMinimum From(PriceProperties::TieredWithMinimum value) { @@ -205,15 +197,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - TieredPackageWithMinimum, - PriceProperties::TieredPackageWithMinimum - >) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class TieredPackageWithMinimum(PriceProperties::TieredPackageWithMinimum Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static TieredPackageWithMinimum From(PriceProperties::TieredPackageWithMinimum value) { @@ -226,12 +215,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class PackageWithAllocation(PriceProperties::PackageWithAllocation Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static PackageWithAllocation From(PriceProperties::PackageWithAllocation value) { @@ -244,12 +233,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class UnitWithPercent(PriceProperties::UnitWithPercent Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static UnitWithPercent From(PriceProperties::UnitWithPercent value) { @@ -262,12 +249,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class MatrixWithAllocation(PriceProperties::MatrixWithAllocation Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static MatrixWithAllocation From(PriceProperties::MatrixWithAllocation value) { @@ -280,12 +267,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class TieredWithProration(PriceProperties::TieredWithProration Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static TieredWithProration From(PriceProperties::TieredWithProration value) { @@ -298,12 +283,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class UnitWithProration(PriceProperties::UnitWithProration Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static UnitWithProration From(PriceProperties::UnitWithProration value) { @@ -316,12 +299,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class GroupedAllocation(PriceProperties::GroupedAllocation Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static GroupedAllocation From(PriceProperties::GroupedAllocation value) { @@ -334,17 +315,15 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< +[JsonConverter( + typeof(VariantConverter< GroupedWithProratedMinimum, PriceProperties::GroupedWithProratedMinimum >) )] public sealed record class GroupedWithProratedMinimum( PriceProperties::GroupedWithProratedMinimum Value -) - : Models::Price, - Orb::IVariant +) : Price, IVariant { public static GroupedWithProratedMinimum From(PriceProperties::GroupedWithProratedMinimum value) { @@ -357,17 +336,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - GroupedWithMeteredMinimum, - PriceProperties::GroupedWithMeteredMinimum - >) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class GroupedWithMeteredMinimum( PriceProperties::GroupedWithMeteredMinimum Value -) - : Models::Price, - Orb::IVariant +) : Price, IVariant { public static GroupedWithMeteredMinimum From(PriceProperties::GroupedWithMeteredMinimum value) { @@ -380,12 +354,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class MatrixWithDisplayName(PriceProperties::MatrixWithDisplayName Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static MatrixWithDisplayName From(PriceProperties::MatrixWithDisplayName value) { @@ -398,12 +372,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class BulkWithProration(PriceProperties::BulkWithProration Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static BulkWithProration From(PriceProperties::BulkWithProration value) { @@ -416,12 +388,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class GroupedTieredPackage(PriceProperties::GroupedTieredPackage Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static GroupedTieredPackage From(PriceProperties::GroupedTieredPackage value) { @@ -434,12 +406,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class MaxGroupTieredPackage(PriceProperties::MaxGroupTieredPackage Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static MaxGroupTieredPackage From(PriceProperties::MaxGroupTieredPackage value) { @@ -452,17 +424,15 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< +[JsonConverter( + typeof(VariantConverter< ScalableMatrixWithUnitPricing, PriceProperties::ScalableMatrixWithUnitPricing >) )] public sealed record class ScalableMatrixWithUnitPricing( PriceProperties::ScalableMatrixWithUnitPricing Value -) - : Models::Price, - Orb::IVariant +) : Price, IVariant { public static ScalableMatrixWithUnitPricing From( PriceProperties::ScalableMatrixWithUnitPricing value @@ -477,8 +447,8 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< +[JsonConverter( + typeof(VariantConverter< ScalableMatrixWithTieredPricing, PriceProperties::ScalableMatrixWithTieredPricing >) @@ -486,11 +456,8 @@ public override void Validate() public sealed record class ScalableMatrixWithTieredPricing( PriceProperties::ScalableMatrixWithTieredPricing Value ) - : Models::Price, - Orb::IVariant< - ScalableMatrixWithTieredPricing, - PriceProperties::ScalableMatrixWithTieredPricing - > + : Price, + IVariant { public static ScalableMatrixWithTieredPricing From( PriceProperties::ScalableMatrixWithTieredPricing value @@ -505,12 +472,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] public sealed record class CumulativeGroupedBulk(PriceProperties::CumulativeGroupedBulk Value) - : Models::Price, - Orb::IVariant + : Price, + IVariant { public static CumulativeGroupedBulk From(PriceProperties::CumulativeGroupedBulk value) { @@ -522,3 +489,26 @@ public override void Validate() this.Value.Validate(); } } + +[JsonConverter( + typeof(VariantConverter< + GroupedWithMinMaxThresholds, + PriceProperties::GroupedWithMinMaxThresholds + >) +)] +public sealed record class GroupedWithMinMaxThresholds( + PriceProperties::GroupedWithMinMaxThresholds Value +) : Price, IVariant +{ + public static GroupedWithMinMaxThresholds From( + PriceProperties::GroupedWithMinMaxThresholds value + ) + { + return new(value); + } + + public override void Validate() + { + this.Value.Validate(); + } +} diff --git a/src/Orb/Models/Prices/EvaluatePriceGroup.cs b/src/Orb/Models/Prices/EvaluatePriceGroup.cs index 10c55ef5..c6fc2652 100644 --- a/src/Orb/Models/Prices/EvaluatePriceGroup.cs +++ b/src/Orb/Models/Prices/EvaluatePriceGroup.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using EvaluatePriceGroupProperties = Orb.Models.Prices.EvaluatePriceGroupProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Prices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EvaluatePriceGroup : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EvaluatePriceGroup : ModelBase, IFromRaw { /// /// The price's output for the group @@ -18,36 +17,36 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The values for the group in the order specified by `grouping_keys` /// - public required Generic::List GroupingValues + public required List GroupingValues { get { - if (!this.Properties.TryGetValue("grouping_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouping_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element ) ?? throw new System::ArgumentNullException("grouping_values"); } - set { this.Properties["grouping_values"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping_values"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,15 +56,15 @@ public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -81,16 +80,14 @@ public override void Validate() public EvaluatePriceGroup() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EvaluatePriceGroup(Generic::Dictionary properties) + [SetsRequiredMembers] + EvaluatePriceGroup(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static EvaluatePriceGroup FromRawUnchecked( - Generic::Dictionary properties - ) + public static EvaluatePriceGroup FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValue.cs b/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValue.cs index 2f44d603..e01185a3 100644 --- a/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValue.cs +++ b/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValue.cs @@ -1,19 +1,21 @@ +using System.Text.Json.Serialization; using GroupingValueVariants = Orb.Models.Prices.EvaluatePriceGroupProperties.GroupingValueVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Prices.EvaluatePriceGroupProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class GroupingValue { internal GroupingValue() { } - public static GroupingValueVariants::UnionMember0 Create(string value) => new(value); + public static implicit operator GroupingValue(string value) => + new GroupingValueVariants::String(value); - public static GroupingValueVariants::UnionMember1 Create(double value) => new(value); + public static implicit operator GroupingValue(double value) => + new GroupingValueVariants::Double(value); - public static GroupingValueVariants::UnionMember2 Create(bool value) => new(value); + public static implicit operator GroupingValue(bool value) => + new GroupingValueVariants::Bool(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValueVariants/All.cs b/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValueVariants/All.cs index abdfb616..983cd089 100644 --- a/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValueVariants/All.cs +++ b/src/Orb/Models/Prices/EvaluatePriceGroupProperties/GroupingValueVariants/All.cs @@ -1,15 +1,11 @@ -using EvaluatePriceGroupProperties = Orb.Models.Prices.EvaluatePriceGroupProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.EvaluatePriceGroupProperties.GroupingValueVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class UnionMember0(string Value) - : EvaluatePriceGroupProperties::GroupingValue, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class String(string Value) : GroupingValue, IVariant { - public static UnionMember0 From(string value) + public static String From(string value) { return new(value); } @@ -17,12 +13,10 @@ public static UnionMember0 From(string value) public override void Validate() { } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class UnionMember1(double Value) - : EvaluatePriceGroupProperties::GroupingValue, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class Double(double Value) : GroupingValue, IVariant { - public static UnionMember1 From(double value) + public static Double From(double value) { return new(value); } @@ -30,12 +24,10 @@ public static UnionMember1 From(double value) public override void Validate() { } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class UnionMember2(bool Value) - : EvaluatePriceGroupProperties::GroupingValue, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class Bool(bool Value) : GroupingValue, IVariant { - public static UnionMember2 From(bool value) + public static Bool From(bool value) { return new(value); } diff --git a/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDFetchParams.cs b/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDFetchParams.cs index 7c2a81f8..132920d0 100644 --- a/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDFetchParams.cs +++ b/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDFetchParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.Prices.ExternalPriceID; @@ -8,13 +7,13 @@ namespace Orb.Models.Prices.ExternalPriceID; /// This endpoint returns a price given an external price id. See the [price creation /// API](/api-reference/price/create-price) for more information about external price aliases. /// -public sealed record class ExternalPriceIDFetchParams : Orb::ParamsBase +public sealed record class ExternalPriceIDFetchParams : ParamsBase { public required string ExternalPriceID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/prices/external_price_id/{0}", this.ExternalPriceID) ) @@ -23,12 +22,12 @@ public sealed record class ExternalPriceIDFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDUpdateParams.cs b/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDUpdateParams.cs index 019b97f2..0d8e9991 100644 --- a/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDUpdateParams.cs +++ b/src/Orb/Models/Prices/ExternalPriceID/ExternalPriceIDUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.Prices.ExternalPriceID; @@ -11,9 +10,9 @@ namespace Orb.Models.Prices.ExternalPriceID; /// This endpoint allows you to update the `metadata` property on a price. If you /// pass null for the metadata value, it will clear any existing metadata for that price. /// -public sealed record class ExternalPriceIDUpdateParams : Orb::ParamsBase +public sealed record class ExternalPriceIDUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string ExternalPriceID; @@ -22,21 +21,21 @@ public sealed record class ExternalPriceIDUpdateParams : Orb::ParamsBase /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/prices/external_price_id/{0}", this.ExternalPriceID) ) @@ -45,21 +44,21 @@ public sealed record class ExternalPriceIDUpdateParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceCreateParams.cs b/src/Orb/Models/Prices/PriceCreateParams.cs index 185b694f..5c9779a8 100644 --- a/src/Orb/Models/Prices/PriceCreateParams.cs +++ b/src/Orb/Models/Prices/PriceCreateParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using PriceCreateParamsProperties = Orb.Models.Prices.PriceCreateParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Prices; @@ -20,24 +19,24 @@ namespace Orb.Models.Prices; /// See the [Price resource](/product-catalog/price-configuration) for the specification /// of different price model configurations possible in this endpoint. /// -public sealed record class PriceCreateParams : Orb::ParamsBase +public sealed record class PriceCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required PriceCreateParamsProperties::Body Body { get { - if (!this.BodyProperties.TryGetValue("body", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("body", out JsonElement element)) throw new System::ArgumentOutOfRangeException("body", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("body"); } - set { this.BodyProperties["body"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["body"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/prices") { @@ -45,21 +44,21 @@ public sealed record class PriceCreateParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceCreateParamsProperties/Body.cs b/src/Orb/Models/Prices/PriceCreateParamsProperties/Body.cs index 80eefa19..6e309b35 100644 --- a/src/Orb/Models/Prices/PriceCreateParamsProperties/Body.cs +++ b/src/Orb/Models/Prices/PriceCreateParamsProperties/Body.cs @@ -1,123 +1,96 @@ +using System.Text.Json.Serialization; using BodyVariants = Orb.Models.Prices.PriceCreateParamsProperties.BodyVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Body { internal Body() { } - public static BodyVariants::NewFloatingUnitPrice Create(Models::NewFloatingUnitPrice value) => - new(value); + public static implicit operator Body(NewFloatingUnitPrice value) => + new BodyVariants::NewFloatingUnitPriceVariant(value); - public static BodyVariants::NewFloatingPackagePrice Create( - Models::NewFloatingPackagePrice value - ) => new(value); + public static implicit operator Body(NewFloatingPackagePrice value) => + new BodyVariants::NewFloatingPackagePriceVariant(value); - public static BodyVariants::NewFloatingMatrixPrice Create( - Models::NewFloatingMatrixPrice value - ) => new(value); + public static implicit operator Body(NewFloatingMatrixPrice value) => + new BodyVariants::NewFloatingMatrixPriceVariant(value); - public static BodyVariants::NewFloatingMatrixWithAllocationPrice Create( - Models::NewFloatingMatrixWithAllocationPrice value - ) => new(value); + public static implicit operator Body(NewFloatingMatrixWithAllocationPrice value) => + new BodyVariants::NewFloatingMatrixWithAllocationPriceVariant(value); - public static BodyVariants::NewFloatingTieredPrice Create( - Models::NewFloatingTieredPrice value - ) => new(value); + public static implicit operator Body(NewFloatingTieredPrice value) => + new BodyVariants::NewFloatingTieredPriceVariant(value); - public static BodyVariants::NewFloatingTieredBPSPrice Create( - Models::NewFloatingTieredBPSPrice value - ) => new(value); + public static implicit operator Body(NewFloatingTieredBPSPrice value) => + new BodyVariants::NewFloatingTieredBPSPriceVariant(value); - public static BodyVariants::NewFloatingBPSPrice Create(Models::NewFloatingBPSPrice value) => - new(value); + public static implicit operator Body(NewFloatingBPSPrice value) => + new BodyVariants::NewFloatingBPSPriceVariant(value); - public static BodyVariants::NewFloatingBulkBPSPrice Create( - Models::NewFloatingBulkBPSPrice value - ) => new(value); + public static implicit operator Body(NewFloatingBulkBPSPrice value) => + new BodyVariants::NewFloatingBulkBPSPriceVariant(value); - public static BodyVariants::NewFloatingBulkPrice Create(Models::NewFloatingBulkPrice value) => - new(value); + public static implicit operator Body(NewFloatingBulkPrice value) => + new BodyVariants::NewFloatingBulkPriceVariant(value); - public static BodyVariants::NewFloatingThresholdTotalAmountPrice Create( - Models::NewFloatingThresholdTotalAmountPrice value - ) => new(value); + public static implicit operator Body(NewFloatingThresholdTotalAmountPrice value) => + new BodyVariants::NewFloatingThresholdTotalAmountPriceVariant(value); - public static BodyVariants::NewFloatingTieredPackagePrice Create( - Models::NewFloatingTieredPackagePrice value - ) => new(value); + public static implicit operator Body(NewFloatingTieredPackagePrice value) => + new BodyVariants::NewFloatingTieredPackagePriceVariant(value); - public static BodyVariants::NewFloatingGroupedTieredPrice Create( - Models::NewFloatingGroupedTieredPrice value - ) => new(value); + public static implicit operator Body(NewFloatingGroupedTieredPrice value) => + new BodyVariants::NewFloatingGroupedTieredPriceVariant(value); - public static BodyVariants::NewFloatingMaxGroupTieredPackagePrice Create( - Models::NewFloatingMaxGroupTieredPackagePrice value - ) => new(value); + public static implicit operator Body(NewFloatingMaxGroupTieredPackagePrice value) => + new BodyVariants::NewFloatingMaxGroupTieredPackagePriceVariant(value); - public static BodyVariants::NewFloatingTieredWithMinimumPrice Create( - Models::NewFloatingTieredWithMinimumPrice value - ) => new(value); + public static implicit operator Body(NewFloatingTieredWithMinimumPrice value) => + new BodyVariants::NewFloatingTieredWithMinimumPriceVariant(value); - public static BodyVariants::NewFloatingPackageWithAllocationPrice Create( - Models::NewFloatingPackageWithAllocationPrice value - ) => new(value); + public static implicit operator Body(NewFloatingPackageWithAllocationPrice value) => + new BodyVariants::NewFloatingPackageWithAllocationPriceVariant(value); - public static BodyVariants::NewFloatingTieredPackageWithMinimumPrice Create( - Models::NewFloatingTieredPackageWithMinimumPrice value - ) => new(value); + public static implicit operator Body(NewFloatingTieredPackageWithMinimumPrice value) => + new BodyVariants::NewFloatingTieredPackageWithMinimumPriceVariant(value); - public static BodyVariants::NewFloatingUnitWithPercentPrice Create( - Models::NewFloatingUnitWithPercentPrice value - ) => new(value); + public static implicit operator Body(NewFloatingUnitWithPercentPrice value) => + new BodyVariants::NewFloatingUnitWithPercentPriceVariant(value); - public static BodyVariants::NewFloatingTieredWithProrationPrice Create( - Models::NewFloatingTieredWithProrationPrice value - ) => new(value); + public static implicit operator Body(NewFloatingTieredWithProrationPrice value) => + new BodyVariants::NewFloatingTieredWithProrationPriceVariant(value); - public static BodyVariants::NewFloatingUnitWithProrationPrice Create( - Models::NewFloatingUnitWithProrationPrice value - ) => new(value); + public static implicit operator Body(NewFloatingUnitWithProrationPrice value) => + new BodyVariants::NewFloatingUnitWithProrationPriceVariant(value); - public static BodyVariants::NewFloatingGroupedAllocationPrice Create( - Models::NewFloatingGroupedAllocationPrice value - ) => new(value); + public static implicit operator Body(NewFloatingGroupedAllocationPrice value) => + new BodyVariants::NewFloatingGroupedAllocationPriceVariant(value); - public static BodyVariants::NewFloatingGroupedWithProratedMinimumPrice Create( - Models::NewFloatingGroupedWithProratedMinimumPrice value - ) => new(value); + public static implicit operator Body(NewFloatingGroupedWithProratedMinimumPrice value) => + new BodyVariants::NewFloatingGroupedWithProratedMinimumPriceVariant(value); - public static BodyVariants::NewFloatingGroupedWithMeteredMinimumPrice Create( - Models::NewFloatingGroupedWithMeteredMinimumPrice value - ) => new(value); + public static implicit operator Body(NewFloatingGroupedWithMeteredMinimumPrice value) => + new BodyVariants::NewFloatingGroupedWithMeteredMinimumPriceVariant(value); - public static BodyVariants::NewFloatingMatrixWithDisplayNamePrice Create( - Models::NewFloatingMatrixWithDisplayNamePrice value - ) => new(value); + public static implicit operator Body(NewFloatingMatrixWithDisplayNamePrice value) => + new BodyVariants::NewFloatingMatrixWithDisplayNamePriceVariant(value); - public static BodyVariants::NewFloatingBulkWithProrationPrice Create( - Models::NewFloatingBulkWithProrationPrice value - ) => new(value); + public static implicit operator Body(NewFloatingBulkWithProrationPrice value) => + new BodyVariants::NewFloatingBulkWithProrationPriceVariant(value); - public static BodyVariants::NewFloatingGroupedTieredPackagePrice Create( - Models::NewFloatingGroupedTieredPackagePrice value - ) => new(value); + public static implicit operator Body(NewFloatingGroupedTieredPackagePrice value) => + new BodyVariants::NewFloatingGroupedTieredPackagePriceVariant(value); - public static BodyVariants::NewFloatingScalableMatrixWithUnitPricingPrice Create( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value - ) => new(value); + public static implicit operator Body(NewFloatingScalableMatrixWithUnitPricingPrice value) => + new BodyVariants::NewFloatingScalableMatrixWithUnitPricingPriceVariant(value); - public static BodyVariants::NewFloatingScalableMatrixWithTieredPricingPrice Create( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value - ) => new(value); + public static implicit operator Body(NewFloatingScalableMatrixWithTieredPricingPrice value) => + new BodyVariants::NewFloatingScalableMatrixWithTieredPricingPriceVariant(value); - public static BodyVariants::NewFloatingCumulativeGroupedBulkPrice Create( - Models::NewFloatingCumulativeGroupedBulkPrice value - ) => new(value); + public static implicit operator Body(NewFloatingCumulativeGroupedBulkPrice value) => + new BodyVariants::NewFloatingCumulativeGroupedBulkPriceVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Prices/PriceCreateParamsProperties/BodyVariants/All.cs b/src/Orb/Models/Prices/PriceCreateParamsProperties/BodyVariants/All.cs index 6d249496..a71633ca 100644 --- a/src/Orb/Models/Prices/PriceCreateParamsProperties/BodyVariants/All.cs +++ b/src/Orb/Models/Prices/PriceCreateParamsProperties/BodyVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceCreateParamsProperties = Orb.Models.Prices.PriceCreateParamsProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceCreateParamsProperties.BodyVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingUnitPrice(Models::NewFloatingUnitPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingUnitPriceVariant(NewFloatingUnitPrice Value) + : Body, + IVariant { - public static NewFloatingUnitPrice From(Models::NewFloatingUnitPrice value) + public static NewFloatingUnitPriceVariant From(NewFloatingUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingPackagePrice(Models::NewFloatingPackagePrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingPackagePriceVariant(NewFloatingPackagePrice Value) + : Body, + IVariant { - public static NewFloatingPackagePrice From(Models::NewFloatingPackagePrice value) + public static NewFloatingPackagePriceVariant From(NewFloatingPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingMatrixPrice(Models::NewFloatingMatrixPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingMatrixPriceVariant(NewFloatingMatrixPrice Value) + : Body, + IVariant { - public static NewFloatingMatrixPrice From(Models::NewFloatingMatrixPrice value) + public static NewFloatingMatrixPriceVariant From(NewFloatingMatrixPrice value) { return new(value); } @@ -59,23 +50,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithAllocationPriceVariant, + NewFloatingMatrixWithAllocationPrice >) )] -public sealed record class NewFloatingMatrixWithAllocationPrice( - Models::NewFloatingMatrixWithAllocationPrice Value +public sealed record class NewFloatingMatrixWithAllocationPriceVariant( + NewFloatingMatrixWithAllocationPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice - > + : Body, + IVariant { - public static NewFloatingMatrixWithAllocationPrice From( - Models::NewFloatingMatrixWithAllocationPrice value + public static NewFloatingMatrixWithAllocationPriceVariant From( + NewFloatingMatrixWithAllocationPrice value ) { return new(value); @@ -87,14 +75,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingTieredPrice(Models::NewFloatingTieredPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingTieredPriceVariant(NewFloatingTieredPrice Value) + : Body, + IVariant { - public static NewFloatingTieredPrice From(Models::NewFloatingTieredPrice value) + public static NewFloatingTieredPriceVariant From(NewFloatingTieredPrice value) { return new(value); } @@ -105,14 +91,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredBPSPrice(Models::NewFloatingTieredBPSPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingTieredBPSPriceVariant(NewFloatingTieredBPSPrice Value) + : Body, + IVariant { - public static NewFloatingTieredBPSPrice From(Models::NewFloatingTieredBPSPrice value) + public static NewFloatingTieredBPSPriceVariant From(NewFloatingTieredBPSPrice value) { return new(value); } @@ -123,14 +109,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBPSPrice(Models::NewFloatingBPSPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBPSPriceVariant(NewFloatingBPSPrice Value) + : Body, + IVariant { - public static NewFloatingBPSPrice From(Models::NewFloatingBPSPrice value) + public static NewFloatingBPSPriceVariant From(NewFloatingBPSPrice value) { return new(value); } @@ -141,14 +125,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkBPSPrice(Models::NewFloatingBulkBPSPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkBPSPriceVariant(NewFloatingBulkBPSPrice Value) + : Body, + IVariant { - public static NewFloatingBulkBPSPrice From(Models::NewFloatingBulkBPSPrice value) + public static NewFloatingBulkBPSPriceVariant From(NewFloatingBulkBPSPrice value) { return new(value); } @@ -159,14 +141,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkPrice(Models::NewFloatingBulkPrice Value) - : PriceCreateParamsProperties::Body, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkPriceVariant(NewFloatingBulkPrice Value) + : Body, + IVariant { - public static NewFloatingBulkPrice From(Models::NewFloatingBulkPrice value) + public static NewFloatingBulkPriceVariant From(NewFloatingBulkPrice value) { return new(value); } @@ -177,23 +157,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingThresholdTotalAmountPriceVariant, + NewFloatingThresholdTotalAmountPrice >) )] -public sealed record class NewFloatingThresholdTotalAmountPrice( - Models::NewFloatingThresholdTotalAmountPrice Value +public sealed record class NewFloatingThresholdTotalAmountPriceVariant( + NewFloatingThresholdTotalAmountPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice - > + : Body, + IVariant { - public static NewFloatingThresholdTotalAmountPrice From( - Models::NewFloatingThresholdTotalAmountPrice value + public static NewFloatingThresholdTotalAmountPriceVariant From( + NewFloatingThresholdTotalAmountPrice value ) { return new(value); @@ -205,19 +182,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackagePrice, - Models::NewFloatingTieredPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredPackagePrice( - Models::NewFloatingTieredPackagePrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingTieredPackagePriceVariant(NewFloatingTieredPackagePrice Value) + : Body, + IVariant { - public static NewFloatingTieredPackagePrice From(Models::NewFloatingTieredPackagePrice value) + public static NewFloatingTieredPackagePriceVariant From(NewFloatingTieredPackagePrice value) { return new(value); } @@ -228,19 +200,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPrice, - Models::NewFloatingGroupedTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingGroupedTieredPrice( - Models::NewFloatingGroupedTieredPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingGroupedTieredPriceVariant(NewFloatingGroupedTieredPrice Value) + : Body, + IVariant { - public static NewFloatingGroupedTieredPrice From(Models::NewFloatingGroupedTieredPrice value) + public static NewFloatingGroupedTieredPriceVariant From(NewFloatingGroupedTieredPrice value) { return new(value); } @@ -251,23 +218,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice >) )] -public sealed record class NewFloatingMaxGroupTieredPackagePrice( - Models::NewFloatingMaxGroupTieredPackagePrice Value +public sealed record class NewFloatingMaxGroupTieredPackagePriceVariant( + NewFloatingMaxGroupTieredPackagePrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice + : Body, + IVariant< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice > { - public static NewFloatingMaxGroupTieredPackagePrice From( - Models::NewFloatingMaxGroupTieredPackagePrice value + public static NewFloatingMaxGroupTieredPackagePriceVariant From( + NewFloatingMaxGroupTieredPackagePrice value ) { return new(value); @@ -279,20 +246,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithMinimumPrice, - Models::NewFloatingTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithMinimumPriceVariant, + NewFloatingTieredWithMinimumPrice >) )] -public sealed record class NewFloatingTieredWithMinimumPrice( - Models::NewFloatingTieredWithMinimumPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingTieredWithMinimumPriceVariant( + NewFloatingTieredWithMinimumPrice Value +) : Body, IVariant { - public static NewFloatingTieredWithMinimumPrice From( - Models::NewFloatingTieredWithMinimumPrice value + public static NewFloatingTieredWithMinimumPriceVariant From( + NewFloatingTieredWithMinimumPrice value ) { return new(value); @@ -304,23 +269,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice >) )] -public sealed record class NewFloatingPackageWithAllocationPrice( - Models::NewFloatingPackageWithAllocationPrice Value +public sealed record class NewFloatingPackageWithAllocationPriceVariant( + NewFloatingPackageWithAllocationPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice + : Body, + IVariant< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice > { - public static NewFloatingPackageWithAllocationPrice From( - Models::NewFloatingPackageWithAllocationPrice value + public static NewFloatingPackageWithAllocationPriceVariant From( + NewFloatingPackageWithAllocationPrice value ) { return new(value); @@ -332,23 +297,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice >) )] -public sealed record class NewFloatingTieredPackageWithMinimumPrice( - Models::NewFloatingTieredPackageWithMinimumPrice Value +public sealed record class NewFloatingTieredPackageWithMinimumPriceVariant( + NewFloatingTieredPackageWithMinimumPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice + : Body, + IVariant< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice > { - public static NewFloatingTieredPackageWithMinimumPrice From( - Models::NewFloatingTieredPackageWithMinimumPrice value + public static NewFloatingTieredPackageWithMinimumPriceVariant From( + NewFloatingTieredPackageWithMinimumPrice value ) { return new(value); @@ -360,21 +325,17 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithPercentPrice, - Models::NewFloatingUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithPercentPriceVariant, + NewFloatingUnitWithPercentPrice >) )] -public sealed record class NewFloatingUnitWithPercentPrice( - Models::NewFloatingUnitWithPercentPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingUnitWithPercentPriceVariant( + NewFloatingUnitWithPercentPrice Value +) : Body, IVariant { - public static NewFloatingUnitWithPercentPrice From( - Models::NewFloatingUnitWithPercentPrice value - ) + public static NewFloatingUnitWithPercentPriceVariant From(NewFloatingUnitWithPercentPrice value) { return new(value); } @@ -385,23 +346,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithProrationPriceVariant, + NewFloatingTieredWithProrationPrice >) )] -public sealed record class NewFloatingTieredWithProrationPrice( - Models::NewFloatingTieredWithProrationPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice - > +public sealed record class NewFloatingTieredWithProrationPriceVariant( + NewFloatingTieredWithProrationPrice Value +) : Body, IVariant { - public static NewFloatingTieredWithProrationPrice From( - Models::NewFloatingTieredWithProrationPrice value + public static NewFloatingTieredWithProrationPriceVariant From( + NewFloatingTieredWithProrationPrice value ) { return new(value); @@ -413,20 +369,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithProrationPrice, - Models::NewFloatingUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithProrationPriceVariant, + NewFloatingUnitWithProrationPrice >) )] -public sealed record class NewFloatingUnitWithProrationPrice( - Models::NewFloatingUnitWithProrationPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingUnitWithProrationPriceVariant( + NewFloatingUnitWithProrationPrice Value +) : Body, IVariant { - public static NewFloatingUnitWithProrationPrice From( - Models::NewFloatingUnitWithProrationPrice value + public static NewFloatingUnitWithProrationPriceVariant From( + NewFloatingUnitWithProrationPrice value ) { return new(value); @@ -438,20 +392,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedAllocationPrice, - Models::NewFloatingGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedAllocationPriceVariant, + NewFloatingGroupedAllocationPrice >) )] -public sealed record class NewFloatingGroupedAllocationPrice( - Models::NewFloatingGroupedAllocationPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingGroupedAllocationPriceVariant( + NewFloatingGroupedAllocationPrice Value +) : Body, IVariant { - public static NewFloatingGroupedAllocationPrice From( - Models::NewFloatingGroupedAllocationPrice value + public static NewFloatingGroupedAllocationPriceVariant From( + NewFloatingGroupedAllocationPrice value ) { return new(value); @@ -463,23 +415,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithProratedMinimumPrice( - Models::NewFloatingGroupedWithProratedMinimumPrice Value +public sealed record class NewFloatingGroupedWithProratedMinimumPriceVariant( + NewFloatingGroupedWithProratedMinimumPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice + : Body, + IVariant< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice > { - public static NewFloatingGroupedWithProratedMinimumPrice From( - Models::NewFloatingGroupedWithProratedMinimumPrice value + public static NewFloatingGroupedWithProratedMinimumPriceVariant From( + NewFloatingGroupedWithProratedMinimumPrice value ) { return new(value); @@ -491,23 +443,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithMeteredMinimumPrice( - Models::NewFloatingGroupedWithMeteredMinimumPrice Value +public sealed record class NewFloatingGroupedWithMeteredMinimumPriceVariant( + NewFloatingGroupedWithMeteredMinimumPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice + : Body, + IVariant< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice > { - public static NewFloatingGroupedWithMeteredMinimumPrice From( - Models::NewFloatingGroupedWithMeteredMinimumPrice value + public static NewFloatingGroupedWithMeteredMinimumPriceVariant From( + NewFloatingGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -519,23 +471,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice >) )] -public sealed record class NewFloatingMatrixWithDisplayNamePrice( - Models::NewFloatingMatrixWithDisplayNamePrice Value +public sealed record class NewFloatingMatrixWithDisplayNamePriceVariant( + NewFloatingMatrixWithDisplayNamePrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice + : Body, + IVariant< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice > { - public static NewFloatingMatrixWithDisplayNamePrice From( - Models::NewFloatingMatrixWithDisplayNamePrice value + public static NewFloatingMatrixWithDisplayNamePriceVariant From( + NewFloatingMatrixWithDisplayNamePrice value ) { return new(value); @@ -547,20 +499,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingBulkWithProrationPrice, - Models::NewFloatingBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingBulkWithProrationPriceVariant, + NewFloatingBulkWithProrationPrice >) )] -public sealed record class NewFloatingBulkWithProrationPrice( - Models::NewFloatingBulkWithProrationPrice Value -) - : PriceCreateParamsProperties::Body, - Orb::IVariant +public sealed record class NewFloatingBulkWithProrationPriceVariant( + NewFloatingBulkWithProrationPrice Value +) : Body, IVariant { - public static NewFloatingBulkWithProrationPrice From( - Models::NewFloatingBulkWithProrationPrice value + public static NewFloatingBulkWithProrationPriceVariant From( + NewFloatingBulkWithProrationPrice value ) { return new(value); @@ -572,23 +522,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedTieredPackagePriceVariant, + NewFloatingGroupedTieredPackagePrice >) )] -public sealed record class NewFloatingGroupedTieredPackagePrice( - Models::NewFloatingGroupedTieredPackagePrice Value +public sealed record class NewFloatingGroupedTieredPackagePriceVariant( + NewFloatingGroupedTieredPackagePrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice - > + : Body, + IVariant { - public static NewFloatingGroupedTieredPackagePrice From( - Models::NewFloatingGroupedTieredPackagePrice value + public static NewFloatingGroupedTieredPackagePriceVariant From( + NewFloatingGroupedTieredPackagePrice value ) { return new(value); @@ -600,23 +547,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithUnitPricingPrice( - Models::NewFloatingScalableMatrixWithUnitPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithUnitPricingPriceVariant( + NewFloatingScalableMatrixWithUnitPricingPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice + : Body, + IVariant< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice > { - public static NewFloatingScalableMatrixWithUnitPricingPrice From( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value + public static NewFloatingScalableMatrixWithUnitPricingPriceVariant From( + NewFloatingScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -628,23 +575,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithTieredPricingPrice( - Models::NewFloatingScalableMatrixWithTieredPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithTieredPricingPriceVariant( + NewFloatingScalableMatrixWithTieredPricingPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice + : Body, + IVariant< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice > { - public static NewFloatingScalableMatrixWithTieredPricingPrice From( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value + public static NewFloatingScalableMatrixWithTieredPricingPriceVariant From( + NewFloatingScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -656,23 +603,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice >) )] -public sealed record class NewFloatingCumulativeGroupedBulkPrice( - Models::NewFloatingCumulativeGroupedBulkPrice Value +public sealed record class NewFloatingCumulativeGroupedBulkPriceVariant( + NewFloatingCumulativeGroupedBulkPrice Value ) - : PriceCreateParamsProperties::Body, - Orb::IVariant< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice + : Body, + IVariant< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice > { - public static NewFloatingCumulativeGroupedBulkPrice From( - Models::NewFloatingCumulativeGroupedBulkPrice value + public static NewFloatingCumulativeGroupedBulkPriceVariant From( + NewFloatingCumulativeGroupedBulkPrice value ) { return new(value); diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleParams.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleParams.cs index 9847c501..11e34f44 100644 --- a/src/Orb/Models/Prices/PriceEvaluateMultipleParams.cs +++ b/src/Orb/Models/Prices/PriceEvaluateMultipleParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using PriceEvaluateMultipleParamsProperties = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Prices; @@ -35,9 +34,9 @@ namespace Orb.Models.Prices; /// Note that this is a POST endpoint rather than a GET endpoint because it employs /// a JSON body rather than query parameters. /// -public sealed record class PriceEvaluateMultipleParams : Orb::ParamsBase +public sealed record class PriceEvaluateMultipleParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// The exclusive upper bound for event timestamps @@ -46,18 +45,15 @@ public sealed record class PriceEvaluateMultipleParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_end", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_end", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// @@ -67,18 +63,15 @@ public sealed record class PriceEvaluateMultipleParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_start", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -88,12 +81,12 @@ public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -103,49 +96,35 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } /// /// List of prices to evaluate (max 100) /// - public Generic::List? PriceEvaluations + public List? PriceEvaluations { get { - if ( - !this.BodyProperties.TryGetValue("price_evaluations", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("price_evaluations", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["price_evaluations"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["price_evaluations"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/prices/evaluate") { @@ -153,21 +132,21 @@ public string? ExternalCustomerID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluation.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluation.cs index bcf186df..3d1fe460 100644 --- a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluation.cs +++ b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluation.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PriceEvaluationProperties = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluateMultipleParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PriceEvaluation : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PriceEvaluation : ModelBase, IFromRaw { /// /// The external ID of a price to evaluate that exists in your Orb account. @@ -17,15 +16,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,44 +32,44 @@ public string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// /// Properties (or [computed properties](/extensibility/advanced-metrics#computed-properties)) /// used to group the underlying billable metric /// - public Generic::List? GroupingKeys + public List? GroupingKeys { get { - if (!this.Properties.TryGetValue("grouping_keys", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping_keys", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["grouping_keys"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping_keys"] = JsonSerializer.SerializeToElement(value); } } /// /// An inline price definition to evaluate, allowing you to test price configurations /// before adding them to Orb. /// - public PriceEvaluationProperties::Price? Price + public PriceEvaluationProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,12 +79,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -106,16 +102,14 @@ public override void Validate() public PriceEvaluation() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceEvaluation(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceEvaluation(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PriceEvaluation FromRawUnchecked( - Generic::Dictionary properties - ) + public static PriceEvaluation FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/Price.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/Price.cs deleted file mode 100644 index eeee512e..00000000 --- a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/Price.cs +++ /dev/null @@ -1,127 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties; - -/// -/// An inline price definition to evaluate, allowing you to test price configurations -/// before adding them to Orb. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewFloatingUnitPrice Create(Models::NewFloatingUnitPrice value) => - new(value); - - public static PriceVariants::NewFloatingPackagePrice Create( - Models::NewFloatingPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixPrice Create( - Models::NewFloatingMatrixPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixWithAllocationPrice Create( - Models::NewFloatingMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPrice Create( - Models::NewFloatingTieredPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredBPSPrice Create( - Models::NewFloatingTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewFloatingBPSPrice Create(Models::NewFloatingBPSPrice value) => - new(value); - - public static PriceVariants::NewFloatingBulkBPSPrice Create( - Models::NewFloatingBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewFloatingBulkPrice Create(Models::NewFloatingBulkPrice value) => - new(value); - - public static PriceVariants::NewFloatingThresholdTotalAmountPrice Create( - Models::NewFloatingThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPackagePrice Create( - Models::NewFloatingTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedTieredPrice Create( - Models::NewFloatingGroupedTieredPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMaxGroupTieredPackagePrice Create( - Models::NewFloatingMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredWithMinimumPrice Create( - Models::NewFloatingTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingPackageWithAllocationPrice Create( - Models::NewFloatingPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPackageWithMinimumPrice Create( - Models::NewFloatingTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingUnitWithPercentPrice Create( - Models::NewFloatingUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredWithProrationPrice Create( - Models::NewFloatingTieredWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingUnitWithProrationPrice Create( - Models::NewFloatingUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedAllocationPrice Create( - Models::NewFloatingGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedWithProratedMinimumPrice Create( - Models::NewFloatingGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedWithMeteredMinimumPrice Create( - Models::NewFloatingGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixWithDisplayNamePrice Create( - Models::NewFloatingMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewFloatingBulkWithProrationPrice Create( - Models::NewFloatingBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedTieredPackagePrice Create( - Models::NewFloatingGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingScalableMatrixWithUnitPricingPrice Create( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewFloatingScalableMatrixWithTieredPricingPrice Create( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewFloatingCumulativeGroupedBulkPrice Create( - Models::NewFloatingCumulativeGroupedBulkPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/Price1.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/Price1.cs new file mode 100644 index 00000000..25d19084 --- /dev/null +++ b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/Price1.cs @@ -0,0 +1,100 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties.PriceVariants; + +namespace Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties; + +/// +/// An inline price definition to evaluate, allowing you to test price configurations +/// before adding them to Orb. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewFloatingUnitPrice value) => + new PriceVariants::NewFloatingUnitPriceVariant(value); + + public static implicit operator Price1(NewFloatingPackagePrice value) => + new PriceVariants::NewFloatingPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixPrice value) => + new PriceVariants::NewFloatingMatrixPriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixWithAllocationPrice value) => + new PriceVariants::NewFloatingMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPrice value) => + new PriceVariants::NewFloatingTieredPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredBPSPrice value) => + new PriceVariants::NewFloatingTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBPSPrice value) => + new PriceVariants::NewFloatingBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkBPSPrice value) => + new PriceVariants::NewFloatingBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkPrice value) => + new PriceVariants::NewFloatingBulkPriceVariant(value); + + public static implicit operator Price1(NewFloatingThresholdTotalAmountPrice value) => + new PriceVariants::NewFloatingThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPackagePrice value) => + new PriceVariants::NewFloatingTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedTieredPrice value) => + new PriceVariants::NewFloatingGroupedTieredPriceVariant(value); + + public static implicit operator Price1(NewFloatingMaxGroupTieredPackagePrice value) => + new PriceVariants::NewFloatingMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredWithMinimumPrice value) => + new PriceVariants::NewFloatingTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingPackageWithAllocationPrice value) => + new PriceVariants::NewFloatingPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPackageWithMinimumPrice value) => + new PriceVariants::NewFloatingTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingUnitWithPercentPrice value) => + new PriceVariants::NewFloatingUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredWithProrationPrice value) => + new PriceVariants::NewFloatingTieredWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingUnitWithProrationPrice value) => + new PriceVariants::NewFloatingUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedAllocationPrice value) => + new PriceVariants::NewFloatingGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewFloatingGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewFloatingGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixWithDisplayNamePrice value) => + new PriceVariants::NewFloatingMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkWithProrationPrice value) => + new PriceVariants::NewFloatingBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedTieredPackagePrice value) => + new PriceVariants::NewFloatingGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewFloatingScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewFloatingScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewFloatingScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewFloatingCumulativeGroupedBulkPrice value) => + new PriceVariants::NewFloatingCumulativeGroupedBulkPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs index 1c64f5c1..b35ad93e 100644 --- a/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Prices/PriceEvaluateMultipleParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceEvaluationProperties = Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingUnitPrice(Models::NewFloatingUnitPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingUnitPriceVariant(NewFloatingUnitPrice Value) + : Price1, + IVariant { - public static NewFloatingUnitPrice From(Models::NewFloatingUnitPrice value) + public static NewFloatingUnitPriceVariant From(NewFloatingUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingPackagePrice(Models::NewFloatingPackagePrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingPackagePriceVariant(NewFloatingPackagePrice Value) + : Price1, + IVariant { - public static NewFloatingPackagePrice From(Models::NewFloatingPackagePrice value) + public static NewFloatingPackagePriceVariant From(NewFloatingPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingMatrixPrice(Models::NewFloatingMatrixPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingMatrixPriceVariant(NewFloatingMatrixPrice Value) + : Price1, + IVariant { - public static NewFloatingMatrixPrice From(Models::NewFloatingMatrixPrice value) + public static NewFloatingMatrixPriceVariant From(NewFloatingMatrixPrice value) { return new(value); } @@ -59,23 +50,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithAllocationPriceVariant, + NewFloatingMatrixWithAllocationPrice >) )] -public sealed record class NewFloatingMatrixWithAllocationPrice( - Models::NewFloatingMatrixWithAllocationPrice Value +public sealed record class NewFloatingMatrixWithAllocationPriceVariant( + NewFloatingMatrixWithAllocationPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice - > + : Price1, + IVariant { - public static NewFloatingMatrixWithAllocationPrice From( - Models::NewFloatingMatrixWithAllocationPrice value + public static NewFloatingMatrixWithAllocationPriceVariant From( + NewFloatingMatrixWithAllocationPrice value ) { return new(value); @@ -87,14 +75,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingTieredPrice(Models::NewFloatingTieredPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingTieredPriceVariant(NewFloatingTieredPrice Value) + : Price1, + IVariant { - public static NewFloatingTieredPrice From(Models::NewFloatingTieredPrice value) + public static NewFloatingTieredPriceVariant From(NewFloatingTieredPrice value) { return new(value); } @@ -105,14 +91,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredBPSPrice(Models::NewFloatingTieredBPSPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredBPSPriceVariant(NewFloatingTieredBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingTieredBPSPrice From(Models::NewFloatingTieredBPSPrice value) + public static NewFloatingTieredBPSPriceVariant From(NewFloatingTieredBPSPrice value) { return new(value); } @@ -123,14 +109,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBPSPrice(Models::NewFloatingBPSPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBPSPriceVariant(NewFloatingBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingBPSPrice From(Models::NewFloatingBPSPrice value) + public static NewFloatingBPSPriceVariant From(NewFloatingBPSPrice value) { return new(value); } @@ -141,14 +125,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkBPSPrice(Models::NewFloatingBulkBPSPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkBPSPriceVariant(NewFloatingBulkBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingBulkBPSPrice From(Models::NewFloatingBulkBPSPrice value) + public static NewFloatingBulkBPSPriceVariant From(NewFloatingBulkBPSPrice value) { return new(value); } @@ -159,14 +141,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkPrice(Models::NewFloatingBulkPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkPriceVariant(NewFloatingBulkPrice Value) + : Price1, + IVariant { - public static NewFloatingBulkPrice From(Models::NewFloatingBulkPrice value) + public static NewFloatingBulkPriceVariant From(NewFloatingBulkPrice value) { return new(value); } @@ -177,23 +157,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingThresholdTotalAmountPriceVariant, + NewFloatingThresholdTotalAmountPrice >) )] -public sealed record class NewFloatingThresholdTotalAmountPrice( - Models::NewFloatingThresholdTotalAmountPrice Value +public sealed record class NewFloatingThresholdTotalAmountPriceVariant( + NewFloatingThresholdTotalAmountPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice - > + : Price1, + IVariant { - public static NewFloatingThresholdTotalAmountPrice From( - Models::NewFloatingThresholdTotalAmountPrice value + public static NewFloatingThresholdTotalAmountPriceVariant From( + NewFloatingThresholdTotalAmountPrice value ) { return new(value); @@ -205,19 +182,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackagePrice, - Models::NewFloatingTieredPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredPackagePrice( - Models::NewFloatingTieredPackagePrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredPackagePriceVariant(NewFloatingTieredPackagePrice Value) + : Price1, + IVariant { - public static NewFloatingTieredPackagePrice From(Models::NewFloatingTieredPackagePrice value) + public static NewFloatingTieredPackagePriceVariant From(NewFloatingTieredPackagePrice value) { return new(value); } @@ -228,19 +200,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPrice, - Models::NewFloatingGroupedTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingGroupedTieredPrice( - Models::NewFloatingGroupedTieredPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingGroupedTieredPriceVariant(NewFloatingGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewFloatingGroupedTieredPrice From(Models::NewFloatingGroupedTieredPrice value) + public static NewFloatingGroupedTieredPriceVariant From(NewFloatingGroupedTieredPrice value) { return new(value); } @@ -251,23 +218,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice >) )] -public sealed record class NewFloatingMaxGroupTieredPackagePrice( - Models::NewFloatingMaxGroupTieredPackagePrice Value +public sealed record class NewFloatingMaxGroupTieredPackagePriceVariant( + NewFloatingMaxGroupTieredPackagePrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice > { - public static NewFloatingMaxGroupTieredPackagePrice From( - Models::NewFloatingMaxGroupTieredPackagePrice value + public static NewFloatingMaxGroupTieredPackagePriceVariant From( + NewFloatingMaxGroupTieredPackagePrice value ) { return new(value); @@ -279,20 +246,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithMinimumPrice, - Models::NewFloatingTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithMinimumPriceVariant, + NewFloatingTieredWithMinimumPrice >) )] -public sealed record class NewFloatingTieredWithMinimumPrice( - Models::NewFloatingTieredWithMinimumPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredWithMinimumPriceVariant( + NewFloatingTieredWithMinimumPrice Value +) : Price1, IVariant { - public static NewFloatingTieredWithMinimumPrice From( - Models::NewFloatingTieredWithMinimumPrice value + public static NewFloatingTieredWithMinimumPriceVariant From( + NewFloatingTieredWithMinimumPrice value ) { return new(value); @@ -304,23 +269,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice >) )] -public sealed record class NewFloatingPackageWithAllocationPrice( - Models::NewFloatingPackageWithAllocationPrice Value +public sealed record class NewFloatingPackageWithAllocationPriceVariant( + NewFloatingPackageWithAllocationPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice + : Price1, + IVariant< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice > { - public static NewFloatingPackageWithAllocationPrice From( - Models::NewFloatingPackageWithAllocationPrice value + public static NewFloatingPackageWithAllocationPriceVariant From( + NewFloatingPackageWithAllocationPrice value ) { return new(value); @@ -332,23 +297,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice >) )] -public sealed record class NewFloatingTieredPackageWithMinimumPrice( - Models::NewFloatingTieredPackageWithMinimumPrice Value +public sealed record class NewFloatingTieredPackageWithMinimumPriceVariant( + NewFloatingTieredPackageWithMinimumPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice > { - public static NewFloatingTieredPackageWithMinimumPrice From( - Models::NewFloatingTieredPackageWithMinimumPrice value + public static NewFloatingTieredPackageWithMinimumPriceVariant From( + NewFloatingTieredPackageWithMinimumPrice value ) { return new(value); @@ -360,21 +325,17 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithPercentPrice, - Models::NewFloatingUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithPercentPriceVariant, + NewFloatingUnitWithPercentPrice >) )] -public sealed record class NewFloatingUnitWithPercentPrice( - Models::NewFloatingUnitWithPercentPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingUnitWithPercentPriceVariant( + NewFloatingUnitWithPercentPrice Value +) : Price1, IVariant { - public static NewFloatingUnitWithPercentPrice From( - Models::NewFloatingUnitWithPercentPrice value - ) + public static NewFloatingUnitWithPercentPriceVariant From(NewFloatingUnitWithPercentPrice value) { return new(value); } @@ -385,23 +346,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithProrationPriceVariant, + NewFloatingTieredWithProrationPrice >) )] -public sealed record class NewFloatingTieredWithProrationPrice( - Models::NewFloatingTieredWithProrationPrice Value +public sealed record class NewFloatingTieredWithProrationPriceVariant( + NewFloatingTieredWithProrationPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice - > + : Price1, + IVariant { - public static NewFloatingTieredWithProrationPrice From( - Models::NewFloatingTieredWithProrationPrice value + public static NewFloatingTieredWithProrationPriceVariant From( + NewFloatingTieredWithProrationPrice value ) { return new(value); @@ -413,20 +371,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithProrationPrice, - Models::NewFloatingUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithProrationPriceVariant, + NewFloatingUnitWithProrationPrice >) )] -public sealed record class NewFloatingUnitWithProrationPrice( - Models::NewFloatingUnitWithProrationPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingUnitWithProrationPriceVariant( + NewFloatingUnitWithProrationPrice Value +) : Price1, IVariant { - public static NewFloatingUnitWithProrationPrice From( - Models::NewFloatingUnitWithProrationPrice value + public static NewFloatingUnitWithProrationPriceVariant From( + NewFloatingUnitWithProrationPrice value ) { return new(value); @@ -438,20 +394,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedAllocationPrice, - Models::NewFloatingGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedAllocationPriceVariant, + NewFloatingGroupedAllocationPrice >) )] -public sealed record class NewFloatingGroupedAllocationPrice( - Models::NewFloatingGroupedAllocationPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingGroupedAllocationPriceVariant( + NewFloatingGroupedAllocationPrice Value +) : Price1, IVariant { - public static NewFloatingGroupedAllocationPrice From( - Models::NewFloatingGroupedAllocationPrice value + public static NewFloatingGroupedAllocationPriceVariant From( + NewFloatingGroupedAllocationPrice value ) { return new(value); @@ -463,23 +417,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithProratedMinimumPrice( - Models::NewFloatingGroupedWithProratedMinimumPrice Value +public sealed record class NewFloatingGroupedWithProratedMinimumPriceVariant( + NewFloatingGroupedWithProratedMinimumPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice > { - public static NewFloatingGroupedWithProratedMinimumPrice From( - Models::NewFloatingGroupedWithProratedMinimumPrice value + public static NewFloatingGroupedWithProratedMinimumPriceVariant From( + NewFloatingGroupedWithProratedMinimumPrice value ) { return new(value); @@ -491,23 +445,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithMeteredMinimumPrice( - Models::NewFloatingGroupedWithMeteredMinimumPrice Value +public sealed record class NewFloatingGroupedWithMeteredMinimumPriceVariant( + NewFloatingGroupedWithMeteredMinimumPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice > { - public static NewFloatingGroupedWithMeteredMinimumPrice From( - Models::NewFloatingGroupedWithMeteredMinimumPrice value + public static NewFloatingGroupedWithMeteredMinimumPriceVariant From( + NewFloatingGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -519,23 +473,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice >) )] -public sealed record class NewFloatingMatrixWithDisplayNamePrice( - Models::NewFloatingMatrixWithDisplayNamePrice Value +public sealed record class NewFloatingMatrixWithDisplayNamePriceVariant( + NewFloatingMatrixWithDisplayNamePrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice > { - public static NewFloatingMatrixWithDisplayNamePrice From( - Models::NewFloatingMatrixWithDisplayNamePrice value + public static NewFloatingMatrixWithDisplayNamePriceVariant From( + NewFloatingMatrixWithDisplayNamePrice value ) { return new(value); @@ -547,20 +501,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingBulkWithProrationPrice, - Models::NewFloatingBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingBulkWithProrationPriceVariant, + NewFloatingBulkWithProrationPrice >) )] -public sealed record class NewFloatingBulkWithProrationPrice( - Models::NewFloatingBulkWithProrationPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingBulkWithProrationPriceVariant( + NewFloatingBulkWithProrationPrice Value +) : Price1, IVariant { - public static NewFloatingBulkWithProrationPrice From( - Models::NewFloatingBulkWithProrationPrice value + public static NewFloatingBulkWithProrationPriceVariant From( + NewFloatingBulkWithProrationPrice value ) { return new(value); @@ -572,23 +524,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedTieredPackagePriceVariant, + NewFloatingGroupedTieredPackagePrice >) )] -public sealed record class NewFloatingGroupedTieredPackagePrice( - Models::NewFloatingGroupedTieredPackagePrice Value +public sealed record class NewFloatingGroupedTieredPackagePriceVariant( + NewFloatingGroupedTieredPackagePrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice - > + : Price1, + IVariant { - public static NewFloatingGroupedTieredPackagePrice From( - Models::NewFloatingGroupedTieredPackagePrice value + public static NewFloatingGroupedTieredPackagePriceVariant From( + NewFloatingGroupedTieredPackagePrice value ) { return new(value); @@ -600,23 +549,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithUnitPricingPrice( - Models::NewFloatingScalableMatrixWithUnitPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithUnitPricingPriceVariant( + NewFloatingScalableMatrixWithUnitPricingPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice > { - public static NewFloatingScalableMatrixWithUnitPricingPrice From( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value + public static NewFloatingScalableMatrixWithUnitPricingPriceVariant From( + NewFloatingScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -628,23 +577,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithTieredPricingPrice( - Models::NewFloatingScalableMatrixWithTieredPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithTieredPricingPriceVariant( + NewFloatingScalableMatrixWithTieredPricingPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice > { - public static NewFloatingScalableMatrixWithTieredPricingPrice From( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value + public static NewFloatingScalableMatrixWithTieredPricingPriceVariant From( + NewFloatingScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -656,23 +605,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice >) )] -public sealed record class NewFloatingCumulativeGroupedBulkPrice( - Models::NewFloatingCumulativeGroupedBulkPrice Value +public sealed record class NewFloatingCumulativeGroupedBulkPriceVariant( + NewFloatingCumulativeGroupedBulkPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice > { - public static NewFloatingCumulativeGroupedBulkPrice From( - Models::NewFloatingCumulativeGroupedBulkPrice value + public static NewFloatingCumulativeGroupedBulkPriceVariant From( + NewFloatingCumulativeGroupedBulkPrice value ) { return new(value); diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleResponse.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleResponse.cs index 282ee794..6e3385ae 100644 --- a/src/Orb/Models/Prices/PriceEvaluateMultipleResponse.cs +++ b/src/Orb/Models/Prices/PriceEvaluateMultipleResponse.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PriceEvaluateMultipleResponseProperties = Orb.Models.Prices.PriceEvaluateMultipleResponseProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Prices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PriceEvaluateMultipleResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element ) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -38,15 +37,15 @@ public override void Validate() public PriceEvaluateMultipleResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceEvaluateMultipleResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceEvaluateMultipleResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PriceEvaluateMultipleResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Prices/PriceEvaluateMultipleResponseProperties/Data.cs b/src/Orb/Models/Prices/PriceEvaluateMultipleResponseProperties/Data.cs index 747ad316..6015921f 100644 --- a/src/Orb/Models/Prices/PriceEvaluateMultipleResponseProperties/Data.cs +++ b/src/Orb/Models/Prices/PriceEvaluateMultipleResponseProperties/Data.cs @@ -1,15 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Prices = Orb.Models.Prices; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluateMultipleResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { /// /// The currency of the price @@ -18,36 +16,29 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// The computed price groups associated with input price. /// - public required Generic::List PriceGroups + public required List PriceGroups { get { - if (!this.Properties.TryGetValue("price_groups", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_groups", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_groups", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_groups", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("price_groups"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("price_groups"); } - set { this.Properties["price_groups"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_groups"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,15 +48,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -75,15 +63,12 @@ public long? InlinePriceIndex { get { - if (!this.Properties.TryGetValue("inline_price_index", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("inline_price_index", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["inline_price_index"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["inline_price_index"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,12 +78,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -116,14 +101,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceEvaluateParams.cs b/src/Orb/Models/Prices/PriceEvaluateParams.cs index 5db7ad9d..2ea27aae 100644 --- a/src/Orb/Models/Prices/PriceEvaluateParams.cs +++ b/src/Orb/Models/Prices/PriceEvaluateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Prices; @@ -32,9 +31,9 @@ namespace Orb.Models.Prices; /// endpoint rather than a GET endpoint because it employs a JSON body rather than /// query parameters. /// -public sealed record class PriceEvaluateParams : Orb::ParamsBase +public sealed record class PriceEvaluateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string PriceID; @@ -45,18 +44,15 @@ public sealed record class PriceEvaluateParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_end", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_end", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// @@ -66,18 +62,15 @@ public sealed record class PriceEvaluateParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_start", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -87,12 +80,12 @@ public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,21 +95,14 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -128,34 +114,31 @@ public string? Filter { get { - if (!this.BodyProperties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["filter"] = JsonSerializer.SerializeToElement(value); } } /// /// Properties (or [computed properties](/extensibility/advanced-metrics#computed-properties)) /// used to group the underlying billable metric /// - public Generic::List? GroupingKeys + public List? GroupingKeys { get { - if (!this.BodyProperties.TryGetValue("grouping_keys", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("grouping_keys", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.BodyProperties["grouping_keys"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.BodyProperties["grouping_keys"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -166,21 +149,21 @@ public string? Filter }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParams.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParams.cs index b994f0ba..cb99077f 100644 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParams.cs +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using PriceEvaluatePreviewEventsParamsProperties = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Prices; @@ -25,9 +24,9 @@ namespace Orb.Models.Prices; /// Note that this is a POST endpoint rather than a GET endpoint because it employs /// a JSON body rather than query parameters. /// -public sealed record class PriceEvaluatePreviewEventsParams : Orb::ParamsBase +public sealed record class PriceEvaluatePreviewEventsParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// The exclusive upper bound for event timestamps @@ -36,18 +35,15 @@ public sealed record class PriceEvaluatePreviewEventsParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_end", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_end", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,18 +53,15 @@ public sealed record class PriceEvaluatePreviewEventsParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("timeframe_start", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,29 +71,29 @@ public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// /// List of preview events to use instead of actual usage data /// - public Generic::List? Events + public List? Events { get { - if (!this.BodyProperties.TryGetValue("events", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("events", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["events"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["events"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,49 +103,35 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } /// /// List of prices to evaluate (max 100) /// - public Generic::List? PriceEvaluations + public List? PriceEvaluations { get { - if ( - !this.BodyProperties.TryGetValue("price_evaluations", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("price_evaluations", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["price_evaluations"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["price_evaluations"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + "/prices/evaluate_preview_events" @@ -162,21 +141,21 @@ public string? ExternalCustomerID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/Event.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/Event.cs index e252fbce..c7516d77 100644 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/Event.cs +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/Event.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Event : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Event : ModelBase, IFromRaw { /// /// A name to meaningfully identify the action or event type. @@ -17,37 +16,30 @@ public required string EventName { get { - if (!this.Properties.TryGetValue("event_name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "event_name", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("event_name", out JsonElement element)) + throw new ArgumentOutOfRangeException("event_name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("event_name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("event_name"); } - set { this.Properties["event_name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["event_name"] = JsonSerializer.SerializeToElement(value); } } /// /// A dictionary of custom properties. Values in this dictionary must be numeric, /// boolean, or strings. Nested dictionaries are disallowed. /// - public required Generic::Dictionary Properties1 + public required Dictionary Properties1 { get { - if (!this.Properties.TryGetValue("properties", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "properties", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("properties", out JsonElement element)) + throw new ArgumentOutOfRangeException("properties", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("properties"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("properties"); } - set { this.Properties["properties"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["properties"] = JsonSerializer.SerializeToElement(value); } } /// @@ -55,19 +47,16 @@ public required string EventName /// the time that usage was recorded, and is particularly important to attribute /// usage to a given billing period. /// - public required System::DateTime Timestamp + public required DateTime Timestamp { get { - if (!this.Properties.TryGetValue("timestamp", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timestamp", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timestamp", out JsonElement element)) + throw new ArgumentOutOfRangeException("timestamp", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timestamp"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timestamp"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,12 +66,12 @@ public string? CustomerID { get { - if (!this.Properties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -92,17 +81,12 @@ public string? ExternalCustomerID { get { - if (!this.Properties.TryGetValue("external_customer_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -120,14 +104,14 @@ public override void Validate() public Event() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Event(Generic::Dictionary properties) + [SetsRequiredMembers] + Event(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Event FromRawUnchecked(Generic::Dictionary properties) + public static Event FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluation.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluation.cs index 13b8e6e0..cc85ffc7 100644 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluation.cs +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluation.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PriceEvaluationProperties = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PriceEvaluation : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PriceEvaluation : ModelBase, IFromRaw { /// /// The external ID of a price to evaluate that exists in your Orb account. @@ -17,15 +16,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,44 +32,44 @@ public string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// /// Properties (or [computed properties](/extensibility/advanced-metrics#computed-properties)) /// used to group the underlying billable metric /// - public Generic::List? GroupingKeys + public List? GroupingKeys { get { - if (!this.Properties.TryGetValue("grouping_keys", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping_keys", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["grouping_keys"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping_keys"] = JsonSerializer.SerializeToElement(value); } } /// /// An inline price definition to evaluate, allowing you to test price configurations /// before adding them to Orb. /// - public PriceEvaluationProperties::Price? Price + public PriceEvaluationProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,12 +79,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -106,16 +102,14 @@ public override void Validate() public PriceEvaluation() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceEvaluation(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceEvaluation(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PriceEvaluation FromRawUnchecked( - Generic::Dictionary properties - ) + public static PriceEvaluation FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/Price.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/Price.cs deleted file mode 100644 index 9d86d2c4..00000000 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/Price.cs +++ /dev/null @@ -1,127 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties; - -/// -/// An inline price definition to evaluate, allowing you to test price configurations -/// before adding them to Orb. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewFloatingUnitPrice Create(Models::NewFloatingUnitPrice value) => - new(value); - - public static PriceVariants::NewFloatingPackagePrice Create( - Models::NewFloatingPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixPrice Create( - Models::NewFloatingMatrixPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixWithAllocationPrice Create( - Models::NewFloatingMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPrice Create( - Models::NewFloatingTieredPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredBPSPrice Create( - Models::NewFloatingTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewFloatingBPSPrice Create(Models::NewFloatingBPSPrice value) => - new(value); - - public static PriceVariants::NewFloatingBulkBPSPrice Create( - Models::NewFloatingBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewFloatingBulkPrice Create(Models::NewFloatingBulkPrice value) => - new(value); - - public static PriceVariants::NewFloatingThresholdTotalAmountPrice Create( - Models::NewFloatingThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPackagePrice Create( - Models::NewFloatingTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedTieredPrice Create( - Models::NewFloatingGroupedTieredPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMaxGroupTieredPackagePrice Create( - Models::NewFloatingMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredWithMinimumPrice Create( - Models::NewFloatingTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingPackageWithAllocationPrice Create( - Models::NewFloatingPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPackageWithMinimumPrice Create( - Models::NewFloatingTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingUnitWithPercentPrice Create( - Models::NewFloatingUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredWithProrationPrice Create( - Models::NewFloatingTieredWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingUnitWithProrationPrice Create( - Models::NewFloatingUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedAllocationPrice Create( - Models::NewFloatingGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedWithProratedMinimumPrice Create( - Models::NewFloatingGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedWithMeteredMinimumPrice Create( - Models::NewFloatingGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixWithDisplayNamePrice Create( - Models::NewFloatingMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewFloatingBulkWithProrationPrice Create( - Models::NewFloatingBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedTieredPackagePrice Create( - Models::NewFloatingGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingScalableMatrixWithUnitPricingPrice Create( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewFloatingScalableMatrixWithTieredPricingPrice Create( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewFloatingCumulativeGroupedBulkPrice Create( - Models::NewFloatingCumulativeGroupedBulkPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/Price1.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/Price1.cs new file mode 100644 index 00000000..0b400cd5 --- /dev/null +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/Price1.cs @@ -0,0 +1,100 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties.PriceVariants; + +namespace Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties; + +/// +/// An inline price definition to evaluate, allowing you to test price configurations +/// before adding them to Orb. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewFloatingUnitPrice value) => + new PriceVariants::NewFloatingUnitPriceVariant(value); + + public static implicit operator Price1(NewFloatingPackagePrice value) => + new PriceVariants::NewFloatingPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixPrice value) => + new PriceVariants::NewFloatingMatrixPriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixWithAllocationPrice value) => + new PriceVariants::NewFloatingMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPrice value) => + new PriceVariants::NewFloatingTieredPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredBPSPrice value) => + new PriceVariants::NewFloatingTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBPSPrice value) => + new PriceVariants::NewFloatingBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkBPSPrice value) => + new PriceVariants::NewFloatingBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkPrice value) => + new PriceVariants::NewFloatingBulkPriceVariant(value); + + public static implicit operator Price1(NewFloatingThresholdTotalAmountPrice value) => + new PriceVariants::NewFloatingThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPackagePrice value) => + new PriceVariants::NewFloatingTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedTieredPrice value) => + new PriceVariants::NewFloatingGroupedTieredPriceVariant(value); + + public static implicit operator Price1(NewFloatingMaxGroupTieredPackagePrice value) => + new PriceVariants::NewFloatingMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredWithMinimumPrice value) => + new PriceVariants::NewFloatingTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingPackageWithAllocationPrice value) => + new PriceVariants::NewFloatingPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPackageWithMinimumPrice value) => + new PriceVariants::NewFloatingTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingUnitWithPercentPrice value) => + new PriceVariants::NewFloatingUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredWithProrationPrice value) => + new PriceVariants::NewFloatingTieredWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingUnitWithProrationPrice value) => + new PriceVariants::NewFloatingUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedAllocationPrice value) => + new PriceVariants::NewFloatingGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewFloatingGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewFloatingGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixWithDisplayNamePrice value) => + new PriceVariants::NewFloatingMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkWithProrationPrice value) => + new PriceVariants::NewFloatingBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedTieredPackagePrice value) => + new PriceVariants::NewFloatingGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewFloatingScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewFloatingScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewFloatingScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewFloatingCumulativeGroupedBulkPrice value) => + new PriceVariants::NewFloatingCumulativeGroupedBulkPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs index ea356350..c128efc2 100644 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsParamsProperties/PriceEvaluationProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceEvaluationProperties = Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingUnitPrice(Models::NewFloatingUnitPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingUnitPriceVariant(NewFloatingUnitPrice Value) + : Price1, + IVariant { - public static NewFloatingUnitPrice From(Models::NewFloatingUnitPrice value) + public static NewFloatingUnitPriceVariant From(NewFloatingUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingPackagePrice(Models::NewFloatingPackagePrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingPackagePriceVariant(NewFloatingPackagePrice Value) + : Price1, + IVariant { - public static NewFloatingPackagePrice From(Models::NewFloatingPackagePrice value) + public static NewFloatingPackagePriceVariant From(NewFloatingPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingMatrixPrice(Models::NewFloatingMatrixPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingMatrixPriceVariant(NewFloatingMatrixPrice Value) + : Price1, + IVariant { - public static NewFloatingMatrixPrice From(Models::NewFloatingMatrixPrice value) + public static NewFloatingMatrixPriceVariant From(NewFloatingMatrixPrice value) { return new(value); } @@ -59,23 +50,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithAllocationPriceVariant, + NewFloatingMatrixWithAllocationPrice >) )] -public sealed record class NewFloatingMatrixWithAllocationPrice( - Models::NewFloatingMatrixWithAllocationPrice Value +public sealed record class NewFloatingMatrixWithAllocationPriceVariant( + NewFloatingMatrixWithAllocationPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice - > + : Price1, + IVariant { - public static NewFloatingMatrixWithAllocationPrice From( - Models::NewFloatingMatrixWithAllocationPrice value + public static NewFloatingMatrixWithAllocationPriceVariant From( + NewFloatingMatrixWithAllocationPrice value ) { return new(value); @@ -87,14 +75,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingTieredPrice(Models::NewFloatingTieredPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingTieredPriceVariant(NewFloatingTieredPrice Value) + : Price1, + IVariant { - public static NewFloatingTieredPrice From(Models::NewFloatingTieredPrice value) + public static NewFloatingTieredPriceVariant From(NewFloatingTieredPrice value) { return new(value); } @@ -105,14 +91,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredBPSPrice(Models::NewFloatingTieredBPSPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredBPSPriceVariant(NewFloatingTieredBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingTieredBPSPrice From(Models::NewFloatingTieredBPSPrice value) + public static NewFloatingTieredBPSPriceVariant From(NewFloatingTieredBPSPrice value) { return new(value); } @@ -123,14 +109,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBPSPrice(Models::NewFloatingBPSPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBPSPriceVariant(NewFloatingBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingBPSPrice From(Models::NewFloatingBPSPrice value) + public static NewFloatingBPSPriceVariant From(NewFloatingBPSPrice value) { return new(value); } @@ -141,14 +125,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkBPSPrice(Models::NewFloatingBulkBPSPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkBPSPriceVariant(NewFloatingBulkBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingBulkBPSPrice From(Models::NewFloatingBulkBPSPrice value) + public static NewFloatingBulkBPSPriceVariant From(NewFloatingBulkBPSPrice value) { return new(value); } @@ -159,14 +141,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkPrice(Models::NewFloatingBulkPrice Value) - : PriceEvaluationProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkPriceVariant(NewFloatingBulkPrice Value) + : Price1, + IVariant { - public static NewFloatingBulkPrice From(Models::NewFloatingBulkPrice value) + public static NewFloatingBulkPriceVariant From(NewFloatingBulkPrice value) { return new(value); } @@ -177,23 +157,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingThresholdTotalAmountPriceVariant, + NewFloatingThresholdTotalAmountPrice >) )] -public sealed record class NewFloatingThresholdTotalAmountPrice( - Models::NewFloatingThresholdTotalAmountPrice Value +public sealed record class NewFloatingThresholdTotalAmountPriceVariant( + NewFloatingThresholdTotalAmountPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice - > + : Price1, + IVariant { - public static NewFloatingThresholdTotalAmountPrice From( - Models::NewFloatingThresholdTotalAmountPrice value + public static NewFloatingThresholdTotalAmountPriceVariant From( + NewFloatingThresholdTotalAmountPrice value ) { return new(value); @@ -205,19 +182,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackagePrice, - Models::NewFloatingTieredPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredPackagePrice( - Models::NewFloatingTieredPackagePrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredPackagePriceVariant(NewFloatingTieredPackagePrice Value) + : Price1, + IVariant { - public static NewFloatingTieredPackagePrice From(Models::NewFloatingTieredPackagePrice value) + public static NewFloatingTieredPackagePriceVariant From(NewFloatingTieredPackagePrice value) { return new(value); } @@ -228,19 +200,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPrice, - Models::NewFloatingGroupedTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingGroupedTieredPrice( - Models::NewFloatingGroupedTieredPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingGroupedTieredPriceVariant(NewFloatingGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewFloatingGroupedTieredPrice From(Models::NewFloatingGroupedTieredPrice value) + public static NewFloatingGroupedTieredPriceVariant From(NewFloatingGroupedTieredPrice value) { return new(value); } @@ -251,23 +218,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice >) )] -public sealed record class NewFloatingMaxGroupTieredPackagePrice( - Models::NewFloatingMaxGroupTieredPackagePrice Value +public sealed record class NewFloatingMaxGroupTieredPackagePriceVariant( + NewFloatingMaxGroupTieredPackagePrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice > { - public static NewFloatingMaxGroupTieredPackagePrice From( - Models::NewFloatingMaxGroupTieredPackagePrice value + public static NewFloatingMaxGroupTieredPackagePriceVariant From( + NewFloatingMaxGroupTieredPackagePrice value ) { return new(value); @@ -279,20 +246,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithMinimumPrice, - Models::NewFloatingTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithMinimumPriceVariant, + NewFloatingTieredWithMinimumPrice >) )] -public sealed record class NewFloatingTieredWithMinimumPrice( - Models::NewFloatingTieredWithMinimumPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredWithMinimumPriceVariant( + NewFloatingTieredWithMinimumPrice Value +) : Price1, IVariant { - public static NewFloatingTieredWithMinimumPrice From( - Models::NewFloatingTieredWithMinimumPrice value + public static NewFloatingTieredWithMinimumPriceVariant From( + NewFloatingTieredWithMinimumPrice value ) { return new(value); @@ -304,23 +269,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice >) )] -public sealed record class NewFloatingPackageWithAllocationPrice( - Models::NewFloatingPackageWithAllocationPrice Value +public sealed record class NewFloatingPackageWithAllocationPriceVariant( + NewFloatingPackageWithAllocationPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice + : Price1, + IVariant< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice > { - public static NewFloatingPackageWithAllocationPrice From( - Models::NewFloatingPackageWithAllocationPrice value + public static NewFloatingPackageWithAllocationPriceVariant From( + NewFloatingPackageWithAllocationPrice value ) { return new(value); @@ -332,23 +297,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice >) )] -public sealed record class NewFloatingTieredPackageWithMinimumPrice( - Models::NewFloatingTieredPackageWithMinimumPrice Value +public sealed record class NewFloatingTieredPackageWithMinimumPriceVariant( + NewFloatingTieredPackageWithMinimumPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice > { - public static NewFloatingTieredPackageWithMinimumPrice From( - Models::NewFloatingTieredPackageWithMinimumPrice value + public static NewFloatingTieredPackageWithMinimumPriceVariant From( + NewFloatingTieredPackageWithMinimumPrice value ) { return new(value); @@ -360,21 +325,17 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithPercentPrice, - Models::NewFloatingUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithPercentPriceVariant, + NewFloatingUnitWithPercentPrice >) )] -public sealed record class NewFloatingUnitWithPercentPrice( - Models::NewFloatingUnitWithPercentPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingUnitWithPercentPriceVariant( + NewFloatingUnitWithPercentPrice Value +) : Price1, IVariant { - public static NewFloatingUnitWithPercentPrice From( - Models::NewFloatingUnitWithPercentPrice value - ) + public static NewFloatingUnitWithPercentPriceVariant From(NewFloatingUnitWithPercentPrice value) { return new(value); } @@ -385,23 +346,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithProrationPriceVariant, + NewFloatingTieredWithProrationPrice >) )] -public sealed record class NewFloatingTieredWithProrationPrice( - Models::NewFloatingTieredWithProrationPrice Value +public sealed record class NewFloatingTieredWithProrationPriceVariant( + NewFloatingTieredWithProrationPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice - > + : Price1, + IVariant { - public static NewFloatingTieredWithProrationPrice From( - Models::NewFloatingTieredWithProrationPrice value + public static NewFloatingTieredWithProrationPriceVariant From( + NewFloatingTieredWithProrationPrice value ) { return new(value); @@ -413,20 +371,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithProrationPrice, - Models::NewFloatingUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithProrationPriceVariant, + NewFloatingUnitWithProrationPrice >) )] -public sealed record class NewFloatingUnitWithProrationPrice( - Models::NewFloatingUnitWithProrationPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingUnitWithProrationPriceVariant( + NewFloatingUnitWithProrationPrice Value +) : Price1, IVariant { - public static NewFloatingUnitWithProrationPrice From( - Models::NewFloatingUnitWithProrationPrice value + public static NewFloatingUnitWithProrationPriceVariant From( + NewFloatingUnitWithProrationPrice value ) { return new(value); @@ -438,20 +394,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedAllocationPrice, - Models::NewFloatingGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedAllocationPriceVariant, + NewFloatingGroupedAllocationPrice >) )] -public sealed record class NewFloatingGroupedAllocationPrice( - Models::NewFloatingGroupedAllocationPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingGroupedAllocationPriceVariant( + NewFloatingGroupedAllocationPrice Value +) : Price1, IVariant { - public static NewFloatingGroupedAllocationPrice From( - Models::NewFloatingGroupedAllocationPrice value + public static NewFloatingGroupedAllocationPriceVariant From( + NewFloatingGroupedAllocationPrice value ) { return new(value); @@ -463,23 +417,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithProratedMinimumPrice( - Models::NewFloatingGroupedWithProratedMinimumPrice Value +public sealed record class NewFloatingGroupedWithProratedMinimumPriceVariant( + NewFloatingGroupedWithProratedMinimumPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice > { - public static NewFloatingGroupedWithProratedMinimumPrice From( - Models::NewFloatingGroupedWithProratedMinimumPrice value + public static NewFloatingGroupedWithProratedMinimumPriceVariant From( + NewFloatingGroupedWithProratedMinimumPrice value ) { return new(value); @@ -491,23 +445,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithMeteredMinimumPrice( - Models::NewFloatingGroupedWithMeteredMinimumPrice Value +public sealed record class NewFloatingGroupedWithMeteredMinimumPriceVariant( + NewFloatingGroupedWithMeteredMinimumPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice > { - public static NewFloatingGroupedWithMeteredMinimumPrice From( - Models::NewFloatingGroupedWithMeteredMinimumPrice value + public static NewFloatingGroupedWithMeteredMinimumPriceVariant From( + NewFloatingGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -519,23 +473,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice >) )] -public sealed record class NewFloatingMatrixWithDisplayNamePrice( - Models::NewFloatingMatrixWithDisplayNamePrice Value +public sealed record class NewFloatingMatrixWithDisplayNamePriceVariant( + NewFloatingMatrixWithDisplayNamePrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice > { - public static NewFloatingMatrixWithDisplayNamePrice From( - Models::NewFloatingMatrixWithDisplayNamePrice value + public static NewFloatingMatrixWithDisplayNamePriceVariant From( + NewFloatingMatrixWithDisplayNamePrice value ) { return new(value); @@ -547,20 +501,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingBulkWithProrationPrice, - Models::NewFloatingBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingBulkWithProrationPriceVariant, + NewFloatingBulkWithProrationPrice >) )] -public sealed record class NewFloatingBulkWithProrationPrice( - Models::NewFloatingBulkWithProrationPrice Value -) - : PriceEvaluationProperties::Price, - Orb::IVariant +public sealed record class NewFloatingBulkWithProrationPriceVariant( + NewFloatingBulkWithProrationPrice Value +) : Price1, IVariant { - public static NewFloatingBulkWithProrationPrice From( - Models::NewFloatingBulkWithProrationPrice value + public static NewFloatingBulkWithProrationPriceVariant From( + NewFloatingBulkWithProrationPrice value ) { return new(value); @@ -572,23 +524,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedTieredPackagePriceVariant, + NewFloatingGroupedTieredPackagePrice >) )] -public sealed record class NewFloatingGroupedTieredPackagePrice( - Models::NewFloatingGroupedTieredPackagePrice Value +public sealed record class NewFloatingGroupedTieredPackagePriceVariant( + NewFloatingGroupedTieredPackagePrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice - > + : Price1, + IVariant { - public static NewFloatingGroupedTieredPackagePrice From( - Models::NewFloatingGroupedTieredPackagePrice value + public static NewFloatingGroupedTieredPackagePriceVariant From( + NewFloatingGroupedTieredPackagePrice value ) { return new(value); @@ -600,23 +549,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithUnitPricingPrice( - Models::NewFloatingScalableMatrixWithUnitPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithUnitPricingPriceVariant( + NewFloatingScalableMatrixWithUnitPricingPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice > { - public static NewFloatingScalableMatrixWithUnitPricingPrice From( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value + public static NewFloatingScalableMatrixWithUnitPricingPriceVariant From( + NewFloatingScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -628,23 +577,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithTieredPricingPrice( - Models::NewFloatingScalableMatrixWithTieredPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithTieredPricingPriceVariant( + NewFloatingScalableMatrixWithTieredPricingPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice > { - public static NewFloatingScalableMatrixWithTieredPricingPrice From( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value + public static NewFloatingScalableMatrixWithTieredPricingPriceVariant From( + NewFloatingScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -656,23 +605,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice >) )] -public sealed record class NewFloatingCumulativeGroupedBulkPrice( - Models::NewFloatingCumulativeGroupedBulkPrice Value +public sealed record class NewFloatingCumulativeGroupedBulkPriceVariant( + NewFloatingCumulativeGroupedBulkPrice Value ) - : PriceEvaluationProperties::Price, - Orb::IVariant< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice > { - public static NewFloatingCumulativeGroupedBulkPrice From( - Models::NewFloatingCumulativeGroupedBulkPrice value + public static NewFloatingCumulativeGroupedBulkPriceVariant From( + NewFloatingCumulativeGroupedBulkPrice value ) { return new(value); diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponse.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponse.cs index 2e49a1f1..483b22ab 100644 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponse.cs +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponse.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using PriceEvaluatePreviewEventsResponseProperties = Orb.Models.Prices.PriceEvaluatePreviewEventsResponseProperties; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Prices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class PriceEvaluatePreviewEventsResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -38,15 +37,15 @@ public override void Validate() public PriceEvaluatePreviewEventsResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceEvaluatePreviewEventsResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceEvaluatePreviewEventsResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static PriceEvaluatePreviewEventsResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponseProperties/Data.cs b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponseProperties/Data.cs index 1bb22077..69d04b97 100644 --- a/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponseProperties/Data.cs +++ b/src/Orb/Models/Prices/PriceEvaluatePreviewEventsResponseProperties/Data.cs @@ -1,15 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Prices = Orb.Models.Prices; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Prices.PriceEvaluatePreviewEventsResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { /// /// The currency of the price @@ -18,36 +16,29 @@ public required string Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "currency", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("currency", out JsonElement element)) + throw new ArgumentOutOfRangeException("currency", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("currency"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("currency"); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// The computed price groups associated with input price. /// - public required Generic::List PriceGroups + public required List PriceGroups { get { - if (!this.Properties.TryGetValue("price_groups", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "price_groups", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("price_groups", out JsonElement element)) + throw new ArgumentOutOfRangeException("price_groups", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("price_groups"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("price_groups"); } - set { this.Properties["price_groups"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_groups"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,15 +48,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -75,15 +63,12 @@ public long? InlinePriceIndex { get { - if (!this.Properties.TryGetValue("inline_price_index", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("inline_price_index", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["inline_price_index"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["inline_price_index"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,12 +78,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -116,14 +101,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceEvaluateResponse.cs b/src/Orb/Models/Prices/PriceEvaluateResponse.cs index 608e91de..0866b969 100644 --- a/src/Orb/Models/Prices/PriceEvaluateResponse.cs +++ b/src/Orb/Models/Prices/PriceEvaluateResponse.cs @@ -1,28 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Prices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PriceEvaluateResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PriceEvaluateResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -36,16 +33,14 @@ public override void Validate() public PriceEvaluateResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceEvaluateResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceEvaluateResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PriceEvaluateResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static PriceEvaluateResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceFetchParams.cs b/src/Orb/Models/Prices/PriceFetchParams.cs index 8a456ed6..fb27d1d5 100644 --- a/src/Orb/Models/Prices/PriceFetchParams.cs +++ b/src/Orb/Models/Prices/PriceFetchParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Prices; @@ -7,11 +6,11 @@ namespace Orb.Models.Prices; /// /// This endpoint returns a price given an identifier. /// -public sealed record class PriceFetchParams : Orb::ParamsBase +public sealed record class PriceFetchParams : ParamsBase { public required string PriceID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/prices/{0}", this.PriceID) @@ -21,12 +20,12 @@ public sealed record class PriceFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceListPageResponse.cs b/src/Orb/Models/Prices/PriceListPageResponse.cs index 887b05f6..2451c2bd 100644 --- a/src/Orb/Models/Prices/PriceListPageResponse.cs +++ b/src/Orb/Models/Prices/PriceListPageResponse.cs @@ -1,48 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Prices; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class PriceListPageResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class PriceListPageResponse : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -57,16 +51,14 @@ public override void Validate() public PriceListPageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - PriceListPageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + PriceListPageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static PriceListPageResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static PriceListPageResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Prices/PriceListParams.cs b/src/Orb/Models/Prices/PriceListParams.cs index 08523a0b..f0789f52 100644 --- a/src/Orb/Models/Prices/PriceListParams.cs +++ b/src/Orb/Models/Prices/PriceListParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Prices; @@ -8,7 +7,7 @@ namespace Orb.Models.Prices; /// /// This endpoint is used to list all add-on prices created using the [price creation endpoint](/api-reference/price/create-price). /// -public sealed record class PriceListParams : Orb::ParamsBase +public sealed record class PriceListParams : ParamsBase { /// /// Cursor for pagination. This can be populated by the `next_cursor` value returned @@ -18,12 +17,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -33,15 +32,15 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/prices") { @@ -49,12 +48,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Prices/PriceUpdateParams.cs b/src/Orb/Models/Prices/PriceUpdateParams.cs index 7ce83975..fdc0e0c4 100644 --- a/src/Orb/Models/Prices/PriceUpdateParams.cs +++ b/src/Orb/Models/Prices/PriceUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Prices; @@ -11,9 +10,9 @@ namespace Orb.Models.Prices; /// This endpoint allows you to update the `metadata` property on a price. If you /// pass null for the metadata value, it will clear any existing metadata for that price. /// -public sealed record class PriceUpdateParams : Orb::ParamsBase +public sealed record class PriceUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string PriceID; @@ -22,19 +21,19 @@ public sealed record class PriceUpdateParams : Orb::ParamsBase /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/prices/{0}", this.PriceID) @@ -44,21 +43,21 @@ public sealed record class PriceUpdateParams : Orb::ParamsBase }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/SubLineItemGrouping.cs b/src/Orb/Models/SubLineItemGrouping.cs index 557baf28..d178afa3 100644 --- a/src/Orb/Models/SubLineItemGrouping.cs +++ b/src/Orb/Models/SubLineItemGrouping.cs @@ -1,26 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class SubLineItemGrouping : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class SubLineItemGrouping : ModelBase, IFromRaw { public required string Key { get { - if (!this.Properties.TryGetValue("key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("key", out JsonElement element)) throw new System::ArgumentOutOfRangeException("key", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("key"); } - set { this.Properties["key"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -30,12 +29,12 @@ public required string? Value { get { - if (!this.Properties.TryGetValue("value", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("value", out JsonElement element)) throw new System::ArgumentOutOfRangeException("value", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["value"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["value"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -47,16 +46,14 @@ public override void Validate() public SubLineItemGrouping() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubLineItemGrouping(Generic::Dictionary properties) + [SetsRequiredMembers] + SubLineItemGrouping(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static SubLineItemGrouping FromRawUnchecked( - Generic::Dictionary properties - ) + public static SubLineItemGrouping FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/SubLineItemMatrixConfig.cs b/src/Orb/Models/SubLineItemMatrixConfig.cs index adaef8dd..7ce136ec 100644 --- a/src/Orb/Models/SubLineItemMatrixConfig.cs +++ b/src/Orb/Models/SubLineItemMatrixConfig.cs @@ -1,37 +1,31 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class SubLineItemMatrixConfig - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class SubLineItemMatrixConfig : ModelBase, IFromRaw { /// /// The ordered dimension values for this line item. /// - public required Generic::List DimensionValues + public required List DimensionValues { get { - if (!this.Properties.TryGetValue("dimension_values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("dimension_values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "dimension_values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("dimension_values"); } - set - { - this.Properties["dimension_values"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["dimension_values"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -45,15 +39,15 @@ public override void Validate() public SubLineItemMatrixConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubLineItemMatrixConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + SubLineItemMatrixConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubLineItemMatrixConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/SubscriptionChangeMinified.cs b/src/Orb/Models/SubscriptionChangeMinified.cs index f718aa9e..4cbdf1d7 100644 --- a/src/Orb/Models/SubscriptionChangeMinified.cs +++ b/src/Orb/Models/SubscriptionChangeMinified.cs @@ -1,28 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class SubscriptionChangeMinified - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -33,15 +32,15 @@ public override void Validate() public SubscriptionChangeMinified() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionChangeMinified(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionChangeMinified(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubscriptionChangeMinified FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/SubscriptionChanges/MutatedSubscription.cs b/src/Orb/Models/SubscriptionChanges/MutatedSubscription.cs index 8100572f..0fa4e1e0 100644 --- a/src/Orb/Models/SubscriptionChanges/MutatedSubscription.cs +++ b/src/Orb/Models/SubscriptionChanges/MutatedSubscription.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Customers = Orb.Models.Customers; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; using MutatedSubscriptionProperties = Orb.Models.SubscriptionChanges.MutatedSubscriptionProperties; -using Orb = Orb; using Plans = Orb.Models.Plans; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.SubscriptionChanges; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MutatedSubscription : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MutatedSubscription : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,24 +33,17 @@ public required long? ActivePlanPhaseOrder { get { - if ( - !this.Properties.TryGetValue( - "active_plan_phase_order", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("active_plan_phase_order", out JsonElement element)) + throw new ArgumentOutOfRangeException( "active_plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["active_plan_phase_order"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["active_plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } @@ -59,26 +51,20 @@ public required long? ActivePlanPhaseOrder /// The adjustment intervals for this subscription sorted by the start_date of /// the adjustment interval. /// - public required Generic::List AdjustmentIntervals + public required List AdjustmentIntervals { get { - if (!this.Properties.TryGetValue("adjustment_intervals", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("adjustment_intervals", out JsonElement element)) + throw new ArgumentOutOfRangeException( "adjustment_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustment_intervals"); - } - set - { - this.Properties["adjustment_intervals"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("adjustment_intervals"); } + set { this.Properties["adjustment_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,15 +76,15 @@ public required bool? AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) + throw new ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleAnchorConfiguration BillingCycleAnchorConfiguration @@ -108,22 +94,21 @@ public required bool? AutoCollection if ( !this.Properties.TryGetValue( "billing_cycle_anchor_configuration", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "billing_cycle_anchor_configuration", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("billing_cycle_anchor_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billing_cycle_anchor_configuration"); } set { this.Properties["billing_cycle_anchor_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -137,33 +122,27 @@ public required long BillingCycleDay { get { - if (!this.Properties.TryGetValue("billing_cycle_day", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billing_cycle_day", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billing_cycle_day", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billing_cycle_day"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billing_cycle_day"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -171,27 +150,28 @@ public required long BillingCycleDay /// that the instant returned is not part of the billing period. Set to null for /// subscriptions that are not currently active. /// - public required System::DateTime? CurrentBillingPeriodEndDate + public required DateTime? CurrentBillingPeriodEndDate { get { if ( !this.Properties.TryGetValue( "current_billing_period_end_date", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "current_billing_period_end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["current_billing_period_end_date"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["current_billing_period_end_date"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -200,27 +180,27 @@ public required long BillingCycleDay /// the instant returned is exactly the beginning of the billing period. Set to /// null if the subscription is not currently active. /// - public required System::DateTime? CurrentBillingPeriodStartDate + public required DateTime? CurrentBillingPeriodStartDate { get { if ( !this.Properties.TryGetValue( "current_billing_period_start_date", - out Json::JsonElement element + out JsonElement element ) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "current_billing_period_start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.Properties["current_billing_period_start_date"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -245,16 +225,13 @@ public required long BillingCycleDay { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "customer", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("customer", out JsonElement element)) + throw new ArgumentOutOfRangeException("customer", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("customer"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } /// @@ -265,87 +242,73 @@ public required string? DefaultInvoiceMemo { get { - if (!this.Properties.TryGetValue("default_invoice_memo", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("default_invoice_memo", out JsonElement element)) + throw new ArgumentOutOfRangeException( "default_invoice_memo", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } /// /// The discount intervals for this subscription sorted by the start_date. This /// field is deprecated in favor of `adjustment_intervals`. /// - public required Generic::List DiscountIntervals + public required List DiscountIntervals { get { - if (!this.Properties.TryGetValue("discount_intervals", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("discount_intervals", out JsonElement element)) + throw new ArgumentOutOfRangeException( "discount_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("discount_intervals"); - } - set - { - this.Properties["discount_intervals"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new ArgumentNullException("discount_intervals"); } + set { this.Properties["discount_intervals"] = JsonSerializer.SerializeToElement(value); } } /// /// The date Orb stops billing for this subscription. /// - public required System::DateTime? EndDate + public required DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "end_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("end_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List FixedFeeQuantitySchedule + public required List FixedFeeQuantitySchedule { get { if ( - !this.Properties.TryGetValue( - "fixed_fee_quantity_schedule", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("fixed_fee_quantity_schedule", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "fixed_fee_quantity_schedule", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("fixed_fee_quantity_schedule"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("fixed_fee_quantity_schedule"); } set { - this.Properties["fixed_fee_quantity_schedule"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["fixed_fee_quantity_schedule"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -353,41 +316,35 @@ public required string? InvoicingThreshold { get { - if (!this.Properties.TryGetValue("invoicing_threshold", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("invoicing_threshold", out JsonElement element)) + throw new ArgumentOutOfRangeException( "invoicing_threshold", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoicing_threshold"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoicing_threshold"] = JsonSerializer.SerializeToElement(value); } } /// /// The maximum intervals for this subscription sorted by the start_date. This /// field is deprecated in favor of `adjustment_intervals`. /// - public required Generic::List MaximumIntervals + public required List MaximumIntervals { get { - if (!this.Properties.TryGetValue("maximum_intervals", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("maximum_intervals", out JsonElement element)) + throw new ArgumentOutOfRangeException( "maximum_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("maximum_intervals"); - } - set - { - this.Properties["maximum_intervals"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("maximum_intervals"); } + set { this.Properties["maximum_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -396,43 +353,37 @@ public required string? InvoicingThreshold /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metadata", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) + throw new ArgumentOutOfRangeException("metadata", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("metadata"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// /// The minimum intervals for this subscription sorted by the start_date. This /// field is deprecated in favor of `adjustment_intervals`. /// - public required Generic::List MinimumIntervals + public required List MinimumIntervals { get { - if (!this.Properties.TryGetValue("minimum_intervals", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("minimum_intervals", out JsonElement element)) + throw new ArgumentOutOfRangeException( "minimum_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("minimum_intervals"); - } - set - { - this.Properties["minimum_intervals"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("minimum_intervals"); } + set { this.Properties["minimum_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -442,13 +393,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -461,15 +412,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "net_terms", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) + throw new ArgumentOutOfRangeException("net_terms", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -480,22 +428,20 @@ public required long NetTerms get { if ( - !this.Properties.TryGetValue( - "pending_subscription_change", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("pending_subscription_change", out JsonElement element) ) - throw new System::ArgumentOutOfRangeException( + throw new ArgumentOutOfRangeException( "pending_subscription_change", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["pending_subscription_change"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["pending_subscription_change"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -508,96 +454,87 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("plan", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("plan", "Missing required argument"); + if (!this.Properties.TryGetValue("plan", out JsonElement element)) + throw new ArgumentOutOfRangeException("plan", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["plan"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan"] = JsonSerializer.SerializeToElement(value); } } /// /// The price intervals for this subscription. /// - public required Generic::List PriceIntervals + public required List PriceIntervals { get { - if (!this.Properties.TryGetValue("price_intervals", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("price_intervals", out JsonElement element)) + throw new ArgumentOutOfRangeException( "price_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("price_intervals"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("price_intervals"); } - set { this.Properties["price_intervals"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_intervals"] = JsonSerializer.SerializeToElement(value); } } public required Models::CouponRedemption? RedeemedCoupon { get { - if (!this.Properties.TryGetValue("redeemed_coupon", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("redeemed_coupon", out JsonElement element)) + throw new ArgumentOutOfRangeException( "redeemed_coupon", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["redeemed_coupon"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["redeemed_coupon"] = JsonSerializer.SerializeToElement(value); } } /// /// The date Orb starts billing for this subscription. /// - public required System::DateTime StartDate + public required DateTime StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "start_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("start_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public required MutatedSubscriptionProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("status"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required Models::SubscriptionTrialInfo TrialInfo { get { - if (!this.Properties.TryGetValue("trial_info", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "trial_info", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("trial_info", out JsonElement element)) + throw new ArgumentOutOfRangeException("trial_info", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("trial_info"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("trial_info"); } - set { this.Properties["trial_info"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["trial_info"] = JsonSerializer.SerializeToElement(value); } } /// @@ -609,15 +546,12 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("changed_resources", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("changed_resources", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["changed_resources"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["changed_resources"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -676,16 +610,14 @@ public override void Validate() public MutatedSubscription() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MutatedSubscription(Generic::Dictionary properties) + [SetsRequiredMembers] + MutatedSubscription(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MutatedSubscription FromRawUnchecked( - Generic::Dictionary properties - ) + public static MutatedSubscription FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountInterval.cs b/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountInterval.cs index 73194203..d09bcab7 100644 --- a/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountInterval.cs +++ b/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountInterval.cs @@ -1,26 +1,21 @@ +using System.Text.Json.Serialization; using DiscountIntervalVariants = Orb.Models.SubscriptionChanges.MutatedSubscriptionProperties.DiscountIntervalVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.SubscriptionChanges.MutatedSubscriptionProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class DiscountInterval { internal DiscountInterval() { } - public static DiscountIntervalVariants::AmountDiscountInterval Create( - Models::AmountDiscountInterval value - ) => new(value); + public static implicit operator DiscountInterval(AmountDiscountInterval value) => + new DiscountIntervalVariants::AmountDiscountIntervalVariant(value); - public static DiscountIntervalVariants::PercentageDiscountInterval Create( - Models::PercentageDiscountInterval value - ) => new(value); + public static implicit operator DiscountInterval(PercentageDiscountInterval value) => + new DiscountIntervalVariants::PercentageDiscountIntervalVariant(value); - public static DiscountIntervalVariants::UsageDiscountInterval Create( - Models::UsageDiscountInterval value - ) => new(value); + public static implicit operator DiscountInterval(UsageDiscountInterval value) => + new DiscountIntervalVariants::UsageDiscountIntervalVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountIntervalVariants/All.cs b/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountIntervalVariants/All.cs index e418d0de..292bfb31 100644 --- a/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountIntervalVariants/All.cs +++ b/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/DiscountIntervalVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using MutatedSubscriptionProperties = Orb.Models.SubscriptionChanges.MutatedSubscriptionProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.SubscriptionChanges.MutatedSubscriptionProperties.DiscountIntervalVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmountDiscountInterval(Models::AmountDiscountInterval Value) - : MutatedSubscriptionProperties::DiscountInterval, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmountDiscountIntervalVariant(AmountDiscountInterval Value) + : DiscountInterval, + IVariant { - public static AmountDiscountInterval From(Models::AmountDiscountInterval value) + public static AmountDiscountIntervalVariant From(AmountDiscountInterval value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PercentageDiscountInterval(Models::PercentageDiscountInterval Value) - : MutatedSubscriptionProperties::DiscountInterval, - Orb::IVariant +public sealed record class PercentageDiscountIntervalVariant(PercentageDiscountInterval Value) + : DiscountInterval, + IVariant { - public static PercentageDiscountInterval From(Models::PercentageDiscountInterval value) + public static PercentageDiscountIntervalVariant From(PercentageDiscountInterval value) { return new(value); } @@ -41,14 +36,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UsageDiscountInterval(Models::UsageDiscountInterval Value) - : MutatedSubscriptionProperties::DiscountInterval, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UsageDiscountIntervalVariant(UsageDiscountInterval Value) + : DiscountInterval, + IVariant { - public static UsageDiscountInterval From(Models::UsageDiscountInterval value) + public static UsageDiscountIntervalVariant From(UsageDiscountInterval value) { return new(value); } diff --git a/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/Status.cs b/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/Status.cs index 72c47e2f..c33d2e4a 100644 --- a/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/Status.cs +++ b/src/Orb/Models/SubscriptionChanges/MutatedSubscriptionProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.SubscriptionChanges.MutatedSubscriptionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -28,7 +27,7 @@ public Value Known() => "active" => Value.Active, "ended" => Value.Ended, "upcoming" => Value.Upcoming, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyParams.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyParams.cs index 529fcf36..1d0f76c6 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyParams.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Text = System.Text; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; namespace Orb.Models.SubscriptionChanges; @@ -12,9 +11,9 @@ namespace Orb.Models.SubscriptionChanges; /// is passed with a request to this endpoint, any eligible invoices that were created /// will be issued immediately if they only contain in-advance fees. /// -public sealed record class SubscriptionChangeApplyParams : Orb::ParamsBase +public sealed record class SubscriptionChangeApplyParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionChangeID; @@ -25,12 +24,12 @@ public string? Description { get { - if (!this.BodyProperties.TryGetValue("description", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("description", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["description"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,23 +42,24 @@ public string? PreviouslyCollectedAmount if ( !this.BodyProperties.TryGetValue( "previously_collected_amount", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["previously_collected_amount"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["previously_collected_amount"] = JsonSerializer.SerializeToElement( + value + ); } } - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/subscription_changes/{0}/apply", this.SubscriptionChangeID) ) @@ -68,21 +68,21 @@ public string? PreviouslyCollectedAmount }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponse.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponse.cs index fdb02885..ddcecd19 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponse.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponse.cs @@ -1,10 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using SubscriptionChangeApplyResponseProperties = Orb.Models.SubscriptionChanges.SubscriptionChangeApplyResponseProperties; -using System = System; namespace Orb.Models.SubscriptionChanges; @@ -13,102 +12,96 @@ namespace Orb.Models.SubscriptionChanges; /// to an existing subscription. It is a way to first preview the effects on the subscription /// as well as any changes/creation of invoices (see `subscription.changed_resources`). /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class SubscriptionChangeApplyResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// Subscription change will be cancelled at this time and can no longer be applied. /// - public required System::DateTime ExpirationTime + public required DateTime ExpirationTime { get { - if (!this.Properties.TryGetValue("expiration_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("expiration_time", out JsonElement element)) + throw new ArgumentOutOfRangeException( "expiration_time", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiration_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiration_time"] = JsonSerializer.SerializeToElement(value); } } public required SubscriptionChangeApplyResponseProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("status"); + ) ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required MutatedSubscription? Subscription { get { - if (!this.Properties.TryGetValue("subscription", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "subscription", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("subscription", out JsonElement element)) + throw new ArgumentOutOfRangeException("subscription", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["subscription"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); } } /// /// When this change was applied. /// - public System::DateTime? AppliedAt + public DateTime? AppliedAt { get { - if (!this.Properties.TryGetValue("applied_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applied_at", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applied_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applied_at"] = JsonSerializer.SerializeToElement(value); } } /// /// When this change was cancelled. /// - public System::DateTime? CancelledAt + public DateTime? CancelledAt { get { - if (!this.Properties.TryGetValue("cancelled_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cancelled_at", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["cancelled_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cancelled_at"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -124,15 +117,15 @@ public override void Validate() public SubscriptionChangeApplyResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionChangeApplyResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionChangeApplyResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubscriptionChangeApplyResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponseProperties/Status.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponseProperties/Status.cs index 45e3cd0d..89749fe9 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponseProperties/Status.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeApplyResponseProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.SubscriptionChanges.SubscriptionChangeApplyResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -28,7 +27,7 @@ public Value Known() => "pending" => Value.Pending, "applied" => Value.Applied, "cancelled" => Value.Cancelled, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelParams.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelParams.cs index 21dab33d..f125c3f3 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelParams.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.SubscriptionChanges; @@ -9,13 +8,13 @@ namespace Orb.Models.SubscriptionChanges; /// can only have one "pending" change at a time - use this endpoint to cancel an /// existing change before creating a new one. /// -public sealed record class SubscriptionChangeCancelParams : Orb::ParamsBase +public sealed record class SubscriptionChangeCancelParams : ParamsBase { public required string SubscriptionChangeID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/subscription_changes/{0}/cancel", this.SubscriptionChangeID) ) @@ -24,12 +23,12 @@ public sealed record class SubscriptionChangeCancelParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponse.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponse.cs index 0e3cf5a8..e98f2abd 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponse.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponse.cs @@ -1,10 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using SubscriptionChangeCancelResponseProperties = Orb.Models.SubscriptionChanges.SubscriptionChangeCancelResponseProperties; -using System = System; namespace Orb.Models.SubscriptionChanges; @@ -13,102 +12,96 @@ namespace Orb.Models.SubscriptionChanges; /// to an existing subscription. It is a way to first preview the effects on the subscription /// as well as any changes/creation of invoices (see `subscription.changed_resources`). /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class SubscriptionChangeCancelResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// Subscription change will be cancelled at this time and can no longer be applied. /// - public required System::DateTime ExpirationTime + public required DateTime ExpirationTime { get { - if (!this.Properties.TryGetValue("expiration_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("expiration_time", out JsonElement element)) + throw new ArgumentOutOfRangeException( "expiration_time", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiration_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiration_time"] = JsonSerializer.SerializeToElement(value); } } public required SubscriptionChangeCancelResponseProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("status"); + ) ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required MutatedSubscription? Subscription { get { - if (!this.Properties.TryGetValue("subscription", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "subscription", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("subscription", out JsonElement element)) + throw new ArgumentOutOfRangeException("subscription", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["subscription"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); } } /// /// When this change was applied. /// - public System::DateTime? AppliedAt + public DateTime? AppliedAt { get { - if (!this.Properties.TryGetValue("applied_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applied_at", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applied_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applied_at"] = JsonSerializer.SerializeToElement(value); } } /// /// When this change was cancelled. /// - public System::DateTime? CancelledAt + public DateTime? CancelledAt { get { - if (!this.Properties.TryGetValue("cancelled_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cancelled_at", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["cancelled_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cancelled_at"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -124,15 +117,15 @@ public override void Validate() public SubscriptionChangeCancelResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionChangeCancelResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionChangeCancelResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubscriptionChangeCancelResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponseProperties/Status.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponseProperties/Status.cs index da5cdfb4..52039120 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponseProperties/Status.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeCancelResponseProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.SubscriptionChanges.SubscriptionChangeCancelResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -28,7 +27,7 @@ public Value Known() => "pending" => Value.Pending, "applied" => Value.Applied, "cancelled" => Value.Cancelled, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveParams.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveParams.cs index 0e46188e..de07cc13 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveParams.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.SubscriptionChanges; @@ -13,13 +12,13 @@ namespace Orb.Models.SubscriptionChanges; /// endpoint](/api-reference/subscription/schedule-plan-change), ...). The subscription /// change will be referenced by the `pending_subscription_change` field in the response. /// -public sealed record class SubscriptionChangeRetrieveParams : Orb::ParamsBase +public sealed record class SubscriptionChangeRetrieveParams : ParamsBase { public required string SubscriptionChangeID; - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder( + return new UriBuilder( client.BaseUrl.ToString().TrimEnd('/') + string.Format("/subscription_changes/{0}", this.SubscriptionChangeID) ) @@ -28,12 +27,12 @@ public sealed record class SubscriptionChangeRetrieveParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponse.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponse.cs index 227d5cc2..4a64b1fd 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponse.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponse.cs @@ -1,10 +1,9 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using SubscriptionChangeRetrieveResponseProperties = Orb.Models.SubscriptionChanges.SubscriptionChangeRetrieveResponseProperties; -using System = System; namespace Orb.Models.SubscriptionChanges; @@ -13,102 +12,96 @@ namespace Orb.Models.SubscriptionChanges; /// to an existing subscription. It is a way to first preview the effects on the subscription /// as well as any changes/creation of invoices (see `subscription.changed_resources`). /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class SubscriptionChangeRetrieveResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// /// Subscription change will be cancelled at this time and can no longer be applied. /// - public required System::DateTime ExpirationTime + public required DateTime ExpirationTime { get { - if (!this.Properties.TryGetValue("expiration_time", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("expiration_time", out JsonElement element)) + throw new ArgumentOutOfRangeException( "expiration_time", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["expiration_time"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["expiration_time"] = JsonSerializer.SerializeToElement(value); } } public required SubscriptionChangeRetrieveResponseProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "status", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("status", out JsonElement element)) + throw new ArgumentOutOfRangeException("status", "Missing required argument"); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element - ) ?? throw new System::ArgumentNullException("status"); + ) ?? throw new ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required MutatedSubscription? Subscription { get { - if (!this.Properties.TryGetValue("subscription", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "subscription", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("subscription", out JsonElement element)) + throw new ArgumentOutOfRangeException("subscription", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["subscription"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); } } /// /// When this change was applied. /// - public System::DateTime? AppliedAt + public DateTime? AppliedAt { get { - if (!this.Properties.TryGetValue("applied_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applied_at", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["applied_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["applied_at"] = JsonSerializer.SerializeToElement(value); } } /// /// When this change was cancelled. /// - public System::DateTime? CancelledAt + public DateTime? CancelledAt { get { - if (!this.Properties.TryGetValue("cancelled_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cancelled_at", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["cancelled_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cancelled_at"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -124,15 +117,15 @@ public override void Validate() public SubscriptionChangeRetrieveResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionChangeRetrieveResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionChangeRetrieveResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubscriptionChangeRetrieveResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponseProperties/Status.cs b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponseProperties/Status.cs index 46816061..f5ee3829 100644 --- a/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponseProperties/Status.cs +++ b/src/Orb/Models/SubscriptionChanges/SubscriptionChangeRetrieveResponseProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.SubscriptionChanges.SubscriptionChangeRetrieveResponseProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Pending = new("pending"); @@ -28,7 +27,7 @@ public Value Known() => "pending" => Value.Pending, "applied" => Value.Applied, "cancelled" => Value.Cancelled, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/SubscriptionMinified.cs b/src/Orb/Models/SubscriptionMinified.cs index 2bd4de41..ec1069a0 100644 --- a/src/Orb/Models/SubscriptionMinified.cs +++ b/src/Orb/Models/SubscriptionMinified.cs @@ -1,28 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class SubscriptionMinified - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class SubscriptionMinified : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -33,16 +30,14 @@ public override void Validate() public SubscriptionMinified() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionMinified(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionMinified(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static SubscriptionMinified FromRawUnchecked( - Generic::Dictionary properties - ) + public static SubscriptionMinified FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/SubscriptionTrialInfo.cs b/src/Orb/Models/SubscriptionTrialInfo.cs index 7fe4cf9d..b01d2bb7 100644 --- a/src/Orb/Models/SubscriptionTrialInfo.cs +++ b/src/Orb/Models/SubscriptionTrialInfo.cs @@ -1,30 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class SubscriptionTrialInfo - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class SubscriptionTrialInfo : ModelBase, IFromRaw { public required System::DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -35,16 +32,14 @@ public override void Validate() public SubscriptionTrialInfo() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionTrialInfo(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionTrialInfo(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static SubscriptionTrialInfo FromRawUnchecked( - Generic::Dictionary properties - ) + public static SubscriptionTrialInfo FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/DiscountOverride.cs b/src/Orb/Models/Subscriptions/DiscountOverride.cs index a058ee2e..fef4a238 100644 --- a/src/Orb/Models/Subscriptions/DiscountOverride.cs +++ b/src/Orb/Models/Subscriptions/DiscountOverride.cs @@ -1,31 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DiscountOverrideProperties = Orb.Models.Subscriptions.DiscountOverrideProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class DiscountOverride : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class DiscountOverride : ModelBase, IFromRaw { public required DiscountOverrideProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,12 +33,12 @@ public string? AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -51,15 +49,12 @@ public double? PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -70,12 +65,12 @@ public double? UsageDiscount { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -89,16 +84,14 @@ public override void Validate() public DiscountOverride() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - DiscountOverride(Generic::Dictionary properties) + [SetsRequiredMembers] + DiscountOverride(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static DiscountOverride FromRawUnchecked( - Generic::Dictionary properties - ) + public static DiscountOverride FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/DiscountOverrideProperties/DiscountType.cs b/src/Orb/Models/Subscriptions/DiscountOverrideProperties/DiscountType.cs index 29dd6b8e..00dff7d9 100644 --- a/src/Orb/Models/Subscriptions/DiscountOverrideProperties/DiscountType.cs +++ b/src/Orb/Models/Subscriptions/DiscountOverrideProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.DiscountOverrideProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Percentage = new("percentage"); @@ -28,7 +27,7 @@ public Value Known() => "percentage" => Value.Percentage, "usage" => Value.Usage, "amount" => Value.Amount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPrice.cs index c59c948a..fc79df48 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPrice.cs @@ -1,33 +1,30 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionBPSPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewSubscriptionBPSPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewSubscriptionBPSPrice : ModelBase, IFromRaw { public required Models::BPSConfig BPSConfig { get { - if (!this.Properties.TryGetValue("bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bps_config"); } - set { this.Properties["bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,17 +34,16 @@ public sealed record class NewSubscriptionBPSPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,33 +53,32 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("model_type"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,13 +88,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +104,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +120,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +136,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +157,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +172,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +193,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +211,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +233,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +248,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +263,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +282,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +302,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +322,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +361,15 @@ public override void Validate() public NewSubscriptionBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionBPSPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/Cadence.cs index 219b4070..7bd21da9 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfig.cs index caafd2fd..3b5e7b48 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfigVariants/All.cs index 6713783f..cb483762 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionBPSPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ModelType.cs index 4959d4e9..5c9c1987 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BPS = new("bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bps" => Value.BPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPrice.cs index f07fa808..75d71429 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPrice.cs @@ -1,33 +1,32 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionBulkBPSPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionBulkBPSPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required Models::BulkBPSConfig BulkBPSConfig { get { - if (!this.Properties.TryGetValue("bulk_bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bulk_bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bulk_bps_config"); } - set { this.Properties["bulk_bps_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,17 +36,17 @@ public sealed record class NewSubscriptionBulkBPSPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,33 +56,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionBulkBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,13 +92,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +108,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +124,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +140,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +161,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +176,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +197,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +215,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +237,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +252,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +267,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +286,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +306,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +326,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +365,15 @@ public override void Validate() public NewSubscriptionBulkBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionBulkBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionBulkBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionBulkBPSPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/Cadence.cs index 4d780cde..c28b1351 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfig.cs index da956354..06a2218c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs index e4c4ea8b..4202533f 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionBulkBPSPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionBulkBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionBulkBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ModelType.cs index 43576211..c95aed14 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BulkBPS = new("bulk_bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk_bps" => Value.BulkBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPrice.cs index db220cf5..66bb1116 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPrice.cs @@ -1,33 +1,30 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionBulkPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewSubscriptionBulkPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewSubscriptionBulkPrice : ModelBase, IFromRaw { public required Models::BulkConfig BulkConfig { get { - if (!this.Properties.TryGetValue("bulk_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("bulk_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("bulk_config"); } - set { this.Properties["bulk_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["bulk_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,17 +34,16 @@ public sealed record class NewSubscriptionBulkPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -57,33 +53,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionBulkPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,13 +89,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +105,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +121,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +137,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +158,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +173,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +194,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +212,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +234,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +249,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +264,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +283,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +303,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +323,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +362,15 @@ public override void Validate() public NewSubscriptionBulkPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionBulkPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionBulkPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionBulkPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/Cadence.cs index 7d3ebcfd..2e26587e 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfig.cs index f6b5944b..5f324f20 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfigVariants/All.cs index 178a3964..7c540744 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionBulkPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ModelType.cs index 26bfc68a..61e9262d 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Bulk = new("bulk"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk" => Value.Bulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPrice.cs index 93dd6c00..0d372f37 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPrice.cs @@ -1,41 +1,33 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionBulkWithProrationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionBulkWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::Dictionary BulkWithProrationConfig + public required Dictionary BulkWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "bulk_with_proration_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("bulk_with_proration_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "bulk_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("bulk_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("bulk_with_proration_config"); } set { - this.Properties["bulk_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["bulk_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -48,17 +40,17 @@ public sealed record class NewSubscriptionBulkWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -68,33 +60,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionBulkWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,13 +96,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -120,15 +112,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,38 +128,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -181,12 +165,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,23 +180,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -224,37 +201,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +241,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +256,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,41 +271,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +310,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -366,12 +330,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -408,15 +372,15 @@ public override void Validate() public NewSubscriptionBulkWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionBulkWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionBulkWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionBulkWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/Cadence.cs index 7f398a73..f111c558 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfig.cs index 74c32349..b6fd61f1 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 01cfb2a4..b7f73539 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionBulkWithProrationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionBulkWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionBulkWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ModelType.cs index 863a4cbb..bf5a2b8a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionBulkWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionBulkWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType BulkWithProration = new("bulk_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "bulk_with_proration" => Value.BulkWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPrice.cs index 5f35dc8b..0b117910 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionCumulativeGroupedBulkPriceProperties = Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionCumulativeGroupedBulkPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,27 +19,27 @@ public sealed record class NewSubscriptionCumulativeGroupedBulkPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary CumulativeGroupedBulkConfig + public required Dictionary CumulativeGroupedBulkConfig { get { if ( !this.Properties.TryGetValue( "cumulative_grouped_bulk_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -51,14 +47,14 @@ public sealed record class NewSubscriptionCumulativeGroupedBulkPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("cumulative_grouped_bulk_config"); } set { - this.Properties["cumulative_grouped_bulk_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["cumulative_grouped_bulk_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,33 +65,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionCumulativeGroupedBulkPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +377,15 @@ public override void Validate() public NewSubscriptionCumulativeGroupedBulkPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionCumulativeGroupedBulkPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionCumulativeGroupedBulkPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionCumulativeGroupedBulkPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/Cadence.cs index 01ab1efa..9326d1cb 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs index 112e04d4..ba267666 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs index c608f457..6942ee85 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionCumulativeGroupedBulkPriceProperties = Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionCumulativeGroupedBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionCumulativeGroupedBulkPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ModelType.cs index 1dc1fba3..edf54411 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionCumulativeGroupedBulkPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionCumulativeGroupedBulkPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType CumulativeGroupedBulk = new("cumulative_grouped_bulk"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "cumulative_grouped_bulk" => Value.CumulativeGroupedBulk, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPrice.cs index f67734cb..525eb305 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionGroupedAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionGroupedAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,43 +19,35 @@ public sealed record class NewSubscriptionGroupedAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedAllocationConfig + public required Dictionary GroupedAllocationConfig { get { - if ( - !this.Properties.TryGetValue( - "grouped_allocation_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("grouped_allocation_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouped_allocation_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_allocation_config"); } set { - this.Properties["grouped_allocation_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["grouped_allocation_config"] = JsonSerializer.SerializeToElement(value); } } @@ -68,33 +58,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionGroupedAllocationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,13 +94,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -120,15 +110,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,38 +126,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -181,12 +163,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,23 +178,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -224,37 +199,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +239,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +254,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,41 +269,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +308,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -366,12 +328,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -408,15 +370,15 @@ public override void Validate() public NewSubscriptionGroupedAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionGroupedAllocationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionGroupedAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionGroupedAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/Cadence.cs index fdca29b6..7df0cfaf 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfig.cs index c1bf93bb..2f337a56 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs index f8442d0f..01ce77f5 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionGroupedAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionGroupedAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionGroupedAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ModelType.cs index 936fd035..08c039fc 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedAllocation = new("grouped_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_allocation" => Value.GroupedAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePrice.cs index 5c05cba0..438d7f84 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionGroupedTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionGroupedTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,27 +19,27 @@ public sealed record class NewSubscriptionGroupedTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredPackageConfig + public required Dictionary GroupedTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "grouped_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -51,14 +47,14 @@ public sealed record class NewSubscriptionGroupedTieredPackagePrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_tiered_package_config"); } set { - this.Properties["grouped_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["grouped_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -69,33 +65,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionGroupedTieredPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +377,15 @@ public override void Validate() public NewSubscriptionGroupedTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionGroupedTieredPackagePrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionGroupedTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionGroupedTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/Cadence.cs index 90274323..5fba65b0 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfig.cs index 8551d004..fa5c2b1c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index 9ae9da86..f6870c8b 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionGroupedTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionGroupedTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionGroupedTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ModelType.cs index ea1ed09f..736d6caf 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedTieredPackage = new("grouped_tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_tiered_package" => Value.GroupedTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPrice.cs index 73cabfc0..1a28cbd4 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionGroupedTieredPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionGroupedTieredPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,41 +19,33 @@ public sealed record class NewSubscriptionGroupedTieredPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedTieredConfig + public required Dictionary GroupedTieredConfig { get { - if ( - !this.Properties.TryGetValue("grouped_tiered_config", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("grouped_tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouped_tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_tiered_config"); - } - set - { - this.Properties["grouped_tiered_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_tiered_config"); } + set { this.Properties["grouped_tiered_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -65,33 +55,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionGroupedTieredPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,13 +91,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,15 +107,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,38 +123,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -178,12 +160,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -193,23 +175,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -221,37 +196,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +236,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +251,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,41 +266,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +305,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +325,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +367,15 @@ public override void Validate() public NewSubscriptionGroupedTieredPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionGroupedTieredPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionGroupedTieredPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionGroupedTieredPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/Cadence.cs index 460392f3..b3781f78 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfig.cs index 8a1a6708..d9740754 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs index dfec9fd2..f93b0006 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionGroupedTieredPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionGroupedTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionGroupedTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ModelType.cs index 71305eb2..ee61a8b2 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedTieredPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedTieredPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedTiered = new("grouped_tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "grouped_tiered" => Value.GroupedTiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPrice.cs index 998a1803..9bed6f0c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionGroupedWithMeteredMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,27 +19,27 @@ public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithMeteredMinimumConfig + public required Dictionary GroupedWithMeteredMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_metered_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -51,14 +47,13 @@ public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("grouped_with_metered_minimum_config"); } set { this.Properties["grouped_with_metered_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -69,33 +64,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionGroupedWithMeteredMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,13 +100,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +116,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +132,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +169,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +184,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +205,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +245,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +260,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +275,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +314,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +334,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +376,15 @@ public override void Validate() public NewSubscriptionGroupedWithMeteredMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionGroupedWithMeteredMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionGroupedWithMeteredMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionGroupedWithMeteredMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/Cadence.cs index fb988fca..d1c4474d 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs index c144fe61..ba58b178 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs index f57018e1..b519b02f 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionGroupedWithMeteredMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionGroupedWithMeteredMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionGroupedWithMeteredMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ModelType.cs index 1b227532..be9af631 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithMeteredMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithMeteredMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedWithMeteredMinimum = new( "grouped_with_metered_minimum" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "grouped_with_metered_minimum" => Value.GroupedWithMeteredMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPrice.cs index 7eb20c38..20c928d1 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionGroupedWithProratedMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,27 +19,27 @@ public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary GroupedWithProratedMinimumConfig + public required Dictionary GroupedWithProratedMinimumConfig { get { if ( !this.Properties.TryGetValue( "grouped_with_prorated_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -51,15 +47,13 @@ public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("grouped_with_prorated_minimum_config"); } set { this.Properties["grouped_with_prorated_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -70,33 +64,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionGroupedWithProratedMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,13 +100,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -122,15 +116,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -141,38 +132,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -183,12 +169,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -198,23 +184,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -226,37 +205,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -267,15 +245,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -285,17 +260,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -305,41 +275,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -348,16 +314,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -368,12 +334,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -410,17 +376,15 @@ public override void Validate() public NewSubscriptionGroupedWithProratedMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionGroupedWithProratedMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionGroupedWithProratedMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionGroupedWithProratedMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/Cadence.cs index 6b27e6c9..436c4ea7 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs index 55dca971..8e6781ac 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 0646b63d..c5945714 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionGroupedWithProratedMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionGroupedWithProratedMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionGroupedWithProratedMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ModelType.cs index f9cb6209..900378a2 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionGroupedWithProratedMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionGroupedWithProratedMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType GroupedWithProratedMinimum = new( "grouped_with_prorated_minimum" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "grouped_with_prorated_minimum" => Value.GroupedWithProratedMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPrice.cs index 547944e1..4727159f 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPrice.cs @@ -1,18 +1,17 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionMatrixPriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionMatrixPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +20,17 @@ public sealed record class NewSubscriptionMatrixPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,49 +40,49 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required Models::MatrixConfig MatrixConfig { get { - if (!this.Properties.TryGetValue("matrix_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("matrix_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "matrix_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_config"); } - set { this.Properties["matrix_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["matrix_config"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionMatrixPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -93,13 +92,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +108,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +124,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +140,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +161,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +176,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +197,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +215,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +237,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +252,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +267,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +286,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +306,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +326,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +365,15 @@ public override void Validate() public NewSubscriptionMatrixPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionMatrixPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionMatrixPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionMatrixPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/Cadence.cs index e72765c6..7b54537c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfig.cs index 1352094e..c94a95d8 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfigVariants/All.cs index a7511893..1fa5ce3a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionMatrixPriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionMatrixPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionMatrixPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ModelType.cs index fe4627f0..db32c7e2 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Matrix = new("matrix"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix" => Value.Matrix, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPrice.cs index 68281400..8357e5ad 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPrice.cs @@ -1,20 +1,17 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionMatrixWithAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionMatrixWithAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +20,17 @@ public sealed record class NewSubscriptionMatrixWithAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,16 +40,16 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required Models::MatrixWithAllocationConfig MatrixWithAllocationConfig @@ -62,7 +59,7 @@ public required string ItemID if ( !this.Properties.TryGetValue( "matrix_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -70,13 +67,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("matrix_with_allocation_config"); } set { - this.Properties["matrix_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -84,17 +82,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,13 +102,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -120,15 +118,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,15 +134,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -158,19 +150,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -181,12 +171,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,23 +186,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -224,12 +207,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -242,19 +225,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +247,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +262,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,17 +277,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -327,17 +296,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +316,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -366,12 +336,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,17 +375,15 @@ public override void Validate() public NewSubscriptionMatrixWithAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionMatrixWithAllocationPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionMatrixWithAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionMatrixWithAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/Cadence.cs index 555fb594..8dae2ff1 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfig.cs index 5b143992..e3f79266 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs index e4311c0e..b5e35c66 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionMatrixWithAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionMatrixWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionMatrixWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ModelType.cs index 42870472..eeae51ab 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MatrixWithAllocation = new("matrix_with_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix_with_allocation" => Value.MatrixWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePrice.cs index e6283c9e..67c6b7bd 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionMatrixWithDisplayNamePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionMatrixWithDisplayNamePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionMatrixWithDisplayNamePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,26 +39,26 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MatrixWithDisplayNameConfig + public required Dictionary MatrixWithDisplayNameConfig { get { if ( !this.Properties.TryGetValue( "matrix_with_display_name_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -70,14 +66,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("matrix_with_display_name_config"); } set { - this.Properties["matrix_with_display_name_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["matrix_with_display_name_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -85,17 +81,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +377,15 @@ public override void Validate() public NewSubscriptionMatrixWithDisplayNamePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionMatrixWithDisplayNamePrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionMatrixWithDisplayNamePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionMatrixWithDisplayNamePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/Cadence.cs index 2369189b..b02eca56 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs index a7731b5d..778cac2a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs index 913c69a8..cb93e2f5 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionMatrixWithDisplayNamePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionMatrixWithDisplayNamePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionMatrixWithDisplayNamePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ModelType.cs index 62ed6d3b..e484f9e4 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMatrixWithDisplayNamePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MatrixWithDisplayName = new("matrix_with_display_name"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "matrix_with_display_name" => Value.MatrixWithDisplayName, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePrice.cs index 301a7531..f0624b1d 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionMaxGroupTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionMaxGroupTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionMaxGroupTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,26 +39,26 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary MaxGroupTieredPackageConfig + public required Dictionary MaxGroupTieredPackageConfig { get { if ( !this.Properties.TryGetValue( "max_group_tiered_package_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -70,14 +66,14 @@ public required string ItemID "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("max_group_tiered_package_config"); } set { - this.Properties["max_group_tiered_package_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["max_group_tiered_package_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -85,17 +81,17 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -105,13 +101,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +377,15 @@ public override void Validate() public NewSubscriptionMaxGroupTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionMaxGroupTieredPackagePrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionMaxGroupTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionMaxGroupTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/Cadence.cs index d74798ff..353bf83a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs index 94edac4e..de2b440e 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index cbee70e2..ed6bf7e7 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionMaxGroupTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionMaxGroupTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionMaxGroupTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ModelType.cs index db0e2818..73fa9cf2 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionMaxGroupTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType MaxGroupTieredPackage = new("max_group_tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "max_group_tiered_package" => Value.MaxGroupTieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePrice.cs index 6d92382c..462fee01 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePrice.cs @@ -1,18 +1,17 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +20,17 @@ public sealed record class NewSubscriptionPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +40,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,29 +76,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required Models::PackageConfig PackageConfig { get { - if (!this.Properties.TryGetValue("package_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("package_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("package_config"); } - set { this.Properties["package_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["package_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +108,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +124,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +140,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +161,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +176,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +197,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +215,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +237,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +252,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +267,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +286,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +306,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +326,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +365,15 @@ public override void Validate() public NewSubscriptionPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/Cadence.cs index 3ffb109e..9e330d40 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfig.cs index 963abd44..31b2ecb7 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfigVariants/All.cs index e081906c..442a51d8 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ModelType.cs index 9b517572..85ed0e2f 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Package = new("package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "package" => Value.Package, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPrice.cs index b3f39bd4..e793c4cc 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionPackageWithAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionPackageWithAllocationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionPackageWithAllocationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionPackageWithAllocationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -79,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary PackageWithAllocationConfig + public required Dictionary PackageWithAllocationConfig { get { if ( !this.Properties.TryGetValue( "package_with_allocation_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -103,14 +99,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("package_with_allocation_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("package_with_allocation_config"); } set { - this.Properties["package_with_allocation_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["package_with_allocation_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -121,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +377,15 @@ public override void Validate() public NewSubscriptionPackageWithAllocationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionPackageWithAllocationPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionPackageWithAllocationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionPackageWithAllocationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/Cadence.cs index f218a6f2..32d3c3cc 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfig.cs index c3e2c265..0bd9ed1a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs index e0773867..c36755c1 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionPackageWithAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionPackageWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionPackageWithAllocationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ModelType.cs index f48aa6a8..1d739e5c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionPackageWithAllocationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType PackageWithAllocation = new("package_with_allocation"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "package_with_allocation" => Value.PackageWithAllocation, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPrice.cs index aced41b6..5b24a6ca 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionScalableMatrixWithTieredPricingPriceProperties = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionScalableMatrixWithTieredPricingPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -79,26 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithTieredPricingConfig + public required Dictionary ScalableMatrixWithTieredPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_tiered_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -106,9 +99,7 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException( "scalable_matrix_with_tiered_pricing_config" ); @@ -116,7 +107,7 @@ public required string Name set { this.Properties["scalable_matrix_with_tiered_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -127,15 +118,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,38 +134,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +171,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +186,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -231,37 +207,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -272,15 +247,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -290,17 +262,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,41 +277,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -353,16 +316,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -373,12 +336,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -415,17 +378,15 @@ public override void Validate() public NewSubscriptionScalableMatrixWithTieredPricingPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionScalableMatrixWithTieredPricingPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionScalableMatrixWithTieredPricingPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionScalableMatrixWithTieredPricingPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/Cadence.cs index 1713faf0..a320820e 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs index cfbba907..caaaf354 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs index f9b4f13b..1974ab43 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionScalableMatrixWithTieredPricingPriceProperties = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionScalableMatrixWithTieredPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionScalableMatrixWithTieredPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ModelType.cs index 88f3e3ef..3e5f18af 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithTieredPricingPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ScalableMatrixWithTieredPricing = new( "scalable_matrix_with_tiered_pricing" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "scalable_matrix_with_tiered_pricing" => Value.ScalableMatrixWithTieredPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPrice.cs index b1f1d4c6..0387677c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionScalableMatrixWithUnitPricingPriceProperties = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionScalableMatrixWithUnitPricingPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -79,26 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary< - string, - Json::JsonElement - > ScalableMatrixWithUnitPricingConfig + public required Dictionary ScalableMatrixWithUnitPricingConfig { get { if ( !this.Properties.TryGetValue( "scalable_matrix_with_unit_pricing_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -106,9 +99,7 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException( "scalable_matrix_with_unit_pricing_config" ); @@ -116,7 +107,7 @@ public required string Name set { this.Properties["scalable_matrix_with_unit_pricing_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -127,15 +118,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -146,38 +134,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -188,12 +171,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -203,23 +186,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -231,37 +207,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -272,15 +247,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -290,17 +262,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -310,41 +277,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -353,16 +316,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -373,12 +336,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -415,17 +378,15 @@ public override void Validate() public NewSubscriptionScalableMatrixWithUnitPricingPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionScalableMatrixWithUnitPricingPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionScalableMatrixWithUnitPricingPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionScalableMatrixWithUnitPricingPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/Cadence.cs index 1a4148f8..61984ff4 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs index 534e12b3..d6018455 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs index c355ccc0..27ab2d56 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionScalableMatrixWithUnitPricingPriceProperties = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionScalableMatrixWithUnitPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionScalableMatrixWithUnitPricingPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ModelType.cs index 310ac50d..858e2564 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionScalableMatrixWithUnitPricingPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithUnitPricingPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ScalableMatrixWithUnitPricing = new( "scalable_matrix_with_unit_pricing" @@ -22,7 +21,7 @@ public Value Known() => _value switch { "scalable_matrix_with_unit_pricing" => Value.ScalableMatrixWithUnitPricing, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPrice.cs index ad58bd61..e7ba8cf9 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionThresholdTotalAmountPriceProperties = Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionThresholdTotalAmountPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionThresholdTotalAmountPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionThresholdTotalAmountPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -79,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary ThresholdTotalAmountConfig + public required Dictionary ThresholdTotalAmountConfig { get { if ( !this.Properties.TryGetValue( "threshold_total_amount_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -103,14 +99,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("threshold_total_amount_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("threshold_total_amount_config"); } set { - this.Properties["threshold_total_amount_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["threshold_total_amount_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -121,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +377,15 @@ public override void Validate() public NewSubscriptionThresholdTotalAmountPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionThresholdTotalAmountPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionThresholdTotalAmountPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionThresholdTotalAmountPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/Cadence.cs index c0df0953..725a3df3 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfig.cs index bff6b250..adf2b881 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs index aee5cb88..56a9215e 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionThresholdTotalAmountPriceProperties = Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionThresholdTotalAmountPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionThresholdTotalAmountPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ModelType.cs index d4e8482d..6273ab7a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionThresholdTotalAmountPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionThresholdTotalAmountPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType ThresholdTotalAmount = new("threshold_total_amount"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "threshold_total_amount" => Value.ThresholdTotalAmount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPrice.cs index ea525a59..157d4221 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionTierWithProrationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionTierWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +19,17 @@ public sealed record class NewSubscriptionTierWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionTierWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithProrationConfig + public required Dictionary TieredWithProrationConfig { get { if ( !this.Properties.TryGetValue( "tiered_with_proration_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -101,14 +99,14 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_with_proration_config"); } set { - this.Properties["tiered_with_proration_config"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["tiered_with_proration_config"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -119,15 +117,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,38 +133,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -180,12 +170,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -195,23 +185,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -223,37 +206,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -264,15 +246,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -282,17 +261,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -302,41 +276,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -345,16 +315,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -365,12 +335,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -407,15 +377,15 @@ public override void Validate() public NewSubscriptionTierWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionTierWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionTierWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionTierWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/Cadence.cs index 9f36ac97..bad37f47 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfig.cs index fb1cf4ac..f18a5f08 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 685a8aa0..7a5a3329 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionTierWithProrationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionTierWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionTierWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ModelType.cs index 0e52cad6..73cabfb7 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTierWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTierWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredWithProration = new("tiered_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_with_proration" => Value.TieredWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPrice.cs index 929dd8d4..eb25d3b9 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPrice.cs @@ -1,18 +1,17 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionTieredBPSPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionTieredBPSPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +20,17 @@ public sealed record class NewSubscriptionTieredBPSPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +40,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionTieredBPSPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,32 +76,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required Models::TieredBPSConfig TieredBPSConfig { get { - if (!this.Properties.TryGetValue("tiered_bps_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_bps_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_bps_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_bps_config"); } - set - { - this.Properties["tiered_bps_config"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["tiered_bps_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -112,15 +108,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -131,15 +124,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -150,19 +140,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -173,12 +161,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -188,23 +176,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -216,12 +197,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -234,19 +215,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -257,15 +237,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -275,17 +252,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -295,17 +267,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -319,17 +286,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -338,16 +306,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -358,12 +326,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -397,15 +365,15 @@ public override void Validate() public NewSubscriptionTieredBPSPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionTieredBPSPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionTieredBPSPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionTieredBPSPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/Cadence.cs index e1bf8e0f..cc35ac27 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfig.cs index 016cf917..cf874047 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs index dc995afb..206796fd 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionTieredBPSPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionTieredBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionTieredBPSPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ModelType.cs index 015f750e..6b9a3e85 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredBPSPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredBPSPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredBPS = new("tiered_bps"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_bps" => Value.TieredBPS, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePrice.cs index f2fc38eb..6f8fdbf0 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionTieredPackagePrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +19,17 @@ public sealed record class NewSubscriptionTieredPackagePrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionTieredPackagePriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,37 +75,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageConfig + public required Dictionary TieredPackageConfig { get { - if ( - !this.Properties.TryGetValue("tiered_package_config", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("tiered_package_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_package_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_config"); - } - set - { - this.Properties["tiered_package_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_package_config"); } + set { this.Properties["tiered_package_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,15 +107,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -136,38 +123,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -178,12 +160,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -193,23 +175,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -221,37 +196,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -262,15 +236,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -280,17 +251,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -300,41 +266,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -343,16 +305,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -363,12 +325,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -405,15 +367,15 @@ public override void Validate() public NewSubscriptionTieredPackagePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionTieredPackagePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionTieredPackagePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionTieredPackagePrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/Cadence.cs index c58e260c..50d76114 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfig.cs index 39d9c9d5..5740b3ad 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs index b833e65c..aa557bfc 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionTieredPackagePriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ModelType.cs index 22eb396a..cf6cb6ac 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackagePriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackagePriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredPackage = new("tiered_package"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_package" => Value.TieredPackage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPrice.cs index 5516e03c..c26136f3 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPrice.cs @@ -1,20 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionTieredPackageWithMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter( - typeof(Orb::ModelConverter) -)] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionTieredPackageWithMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -23,17 +19,17 @@ public sealed record class NewSubscriptionTieredPackageWithMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionTieredPackageWithMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -79,23 +75,23 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredPackageWithMinimumConfig + public required Dictionary TieredPackageWithMinimumConfig { get { if ( !this.Properties.TryGetValue( "tiered_package_with_minimum_config", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -103,14 +99,13 @@ public required string Name "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_package_with_minimum_config"); } set { this.Properties["tiered_package_with_minimum_config"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -121,15 +116,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -140,38 +132,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -182,12 +169,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -197,23 +184,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -225,37 +205,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -266,15 +245,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -284,17 +260,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -304,41 +275,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -347,16 +314,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -367,12 +334,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -409,17 +376,15 @@ public override void Validate() public NewSubscriptionTieredPackageWithMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionTieredPackageWithMinimumPrice( - Generic::Dictionary properties - ) + [SetsRequiredMembers] + NewSubscriptionTieredPackageWithMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionTieredPackageWithMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/Cadence.cs index 0b425ed6..2c91526d 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs index 2e4adcaf..19de4aca 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs index f1767754..8e692837 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionTieredPackageWithMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionTieredPackageWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionTieredPackageWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ModelType.cs index 469b1d6b..23bfe0f6 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPackageWithMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPackageWithMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredPackageWithMinimum = new("tiered_package_with_minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_package_with_minimum" => Value.TieredPackageWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPrice.cs index 7d1ecd1e..5d968584 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPrice.cs @@ -1,18 +1,17 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionTieredPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionTieredPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +20,17 @@ public sealed record class NewSubscriptionTieredPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +40,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionTieredPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,29 +76,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required Models::TieredConfig TieredConfig { get { - if (!this.Properties.TryGetValue("tiered_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_config"); } - set { this.Properties["tiered_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiered_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +108,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +124,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +140,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +161,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +176,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +197,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +215,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +237,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +252,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +267,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +286,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +306,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +326,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +365,15 @@ public override void Validate() public NewSubscriptionTieredPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionTieredPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionTieredPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionTieredPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/Cadence.cs index 122abf01..b7d56df4 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfig.cs index 739ecfca..910c822e 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfigVariants/All.cs index 96bc1ec1..eb2cda69 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionTieredPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionTieredPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ModelType.cs index 3704e42c..ac4191fd 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Tiered = new("tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered" => Value.Tiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPrice.cs index 9d4ec07b..20ababf4 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionTieredWithMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionTieredWithMinimumPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +19,17 @@ public sealed record class NewSubscriptionTieredWithMinimumPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionTieredWithMinimumPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,37 +75,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary TieredWithMinimumConfig + public required Dictionary TieredWithMinimumConfig { get { - if ( - !this.Properties.TryGetValue( - "tiered_with_minimum_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("tiered_with_minimum_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_with_minimum_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("tiered_with_minimum_config"); } set { - this.Properties["tiered_with_minimum_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["tiered_with_minimum_config"] = JsonSerializer.SerializeToElement( value ); } @@ -120,15 +112,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,38 +128,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -181,12 +165,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,23 +180,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -224,37 +201,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +241,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +256,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,41 +271,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +310,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -366,12 +330,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -408,15 +372,15 @@ public override void Validate() public NewSubscriptionTieredWithMinimumPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionTieredWithMinimumPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionTieredWithMinimumPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionTieredWithMinimumPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/Cadence.cs index 31240a62..2c40bb3b 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfig.cs index c577c27a..b50c4238 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs index 81308c45..8010309a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionTieredWithMinimumPriceProperties = Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionTieredWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionTieredWithMinimumPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ModelType.cs index 1ec48f93..55bbe45f 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionTieredWithMinimumPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionTieredWithMinimumPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType TieredWithMinimum = new("tiered_with_minimum"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered_with_minimum" => Value.TieredWithMinimum, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPrice.cs index a33055de..25d43fa1 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPrice.cs @@ -1,18 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; using NewSubscriptionUnitPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class NewSubscriptionUnitPrice - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class NewSubscriptionUnitPrice : ModelBase, IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +18,16 @@ public sealed record class NewSubscriptionUnitPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("cadence"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +37,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionUnitPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,29 +73,29 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required Models::UnitConfig UnitConfig { get { - if (!this.Properties.TryGetValue("unit_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_config"); } - set { this.Properties["unit_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_config"] = JsonSerializer.SerializeToElement(value); } } /// @@ -109,15 +105,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -128,15 +121,12 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// @@ -147,19 +137,17 @@ public bool? BilledInAdvance get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -170,12 +158,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -185,23 +173,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -213,12 +194,12 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -231,19 +212,18 @@ public string? Currency if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -254,15 +234,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -272,17 +249,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -292,17 +264,12 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// @@ -316,17 +283,18 @@ public string? InvoiceGroupingKey if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -335,16 +303,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -355,12 +323,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -394,15 +362,15 @@ public override void Validate() public NewSubscriptionUnitPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionUnitPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionUnitPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionUnitPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/Cadence.cs index 770fab2c..72ff4937 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfig.cs index 9a11e27c..53da77d0 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfigVariants/All.cs index 3fb69ee2..ed9ce8e5 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionUnitPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionUnitPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionUnitPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ModelType.cs index 1d27ee47..4a7c8cbe 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType Unit = new("unit"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit" => Value.Unit, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPrice.cs index ae159885..5fde0117 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionUnitWithPercentPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionUnitWithPercentPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +19,17 @@ public sealed record class NewSubscriptionUnitWithPercentPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionUnitWithPercentPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,39 +75,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithPercentConfig + public required Dictionary UnitWithPercentConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_percent_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("unit_with_percent_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_with_percent_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_percent_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("unit_with_percent_config"); } set { - this.Properties["unit_with_percent_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["unit_with_percent_config"] = JsonSerializer.SerializeToElement(value); } } @@ -120,15 +110,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,38 +126,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -181,12 +163,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,23 +178,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -224,37 +199,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +239,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +254,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,41 +269,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +308,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -366,12 +328,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -408,15 +370,15 @@ public override void Validate() public NewSubscriptionUnitWithPercentPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionUnitWithPercentPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionUnitWithPercentPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionUnitWithPercentPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/Cadence.cs index dd13036f..5a565777 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfig.cs index 24fd5ef9..9a90a61c 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs index bb15196d..1eed675d 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionUnitWithPercentPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionUnitWithPercentPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionUnitWithPercentPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ModelType.cs index 3dd5479f..4b5466b6 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithPercentPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithPercentPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType UnitWithPercent = new("unit_with_percent"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit_with_percent" => Value.UnitWithPercent, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPrice.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPrice.cs index ed368e39..aa0f120e 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPrice.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPrice.cs @@ -1,18 +1,16 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using NewSubscriptionUnitWithProrationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class NewSubscriptionUnitWithProrationPrice - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { /// /// The cadence to bill for this price on. @@ -21,17 +19,17 @@ public sealed record class NewSubscriptionUnitWithProrationPrice { get { - if (!this.Properties.TryGetValue("cadence", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("cadence", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cadence", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cadence"); } - set { this.Properties["cadence"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["cadence"] = JsonSerializer.SerializeToElement(value); } } /// @@ -41,33 +39,33 @@ public required string ItemID { get { - if (!this.Properties.TryGetValue("item_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("item_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "item_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("item_id"); } - set { this.Properties["item_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["item_id"] = JsonSerializer.SerializeToElement(value); } } public required NewSubscriptionUnitWithProrationPriceProperties::ModelType ModelType { get { - if (!this.Properties.TryGetValue("model_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("model_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "model_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("model_type"); } - set { this.Properties["model_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["model_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -77,37 +75,31 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::Dictionary UnitWithProrationConfig + public required Dictionary UnitWithProrationConfig { get { - if ( - !this.Properties.TryGetValue( - "unit_with_proration_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("unit_with_proration_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_with_proration_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("unit_with_proration_config"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("unit_with_proration_config"); } set { - this.Properties["unit_with_proration_config"] = Json::JsonSerializer.SerializeToElement( + this.Properties["unit_with_proration_config"] = JsonSerializer.SerializeToElement( value ); } @@ -120,15 +112,12 @@ public string? BillableMetricID { get { - if (!this.Properties.TryGetValue("billable_metric_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -139,38 +128,33 @@ public bool? BilledInAdvance { get { - if (!this.Properties.TryGetValue("billed_in_advance", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billed_in_advance", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billed_in_advance"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billed_in_advance"] = JsonSerializer.SerializeToElement(value); } } /// /// For custom cadence: specifies the duration of the billing period in days or months. /// - public Models::NewBillingCycleConfiguration? BillingCycleConfiguration + public NewBillingCycleConfiguration? BillingCycleConfiguration { get { if ( - !this.Properties.TryGetValue( - "billing_cycle_configuration", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("billing_cycle_configuration", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["billing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["billing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -181,12 +165,12 @@ public double? ConversionRate { get { - if (!this.Properties.TryGetValue("conversion_rate", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["conversion_rate"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["conversion_rate"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,23 +180,16 @@ public double? ConversionRate { get { - if ( - !this.Properties.TryGetValue( - "conversion_rate_config", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("conversion_rate_config", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.Properties["conversion_rate_config"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["conversion_rate_config"] = JsonSerializer.SerializeToElement(value); } } @@ -224,37 +201,36 @@ public string? Currency { get { - if (!this.Properties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); } } /// /// For dimensional price: specifies a price group and dimension values /// - public Models::NewDimensionalPriceConfiguration? DimensionalPriceConfiguration + public NewDimensionalPriceConfiguration? DimensionalPriceConfiguration { get { if ( !this.Properties.TryGetValue( "dimensional_price_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { - this.Properties["dimensional_price_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["dimensional_price_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -265,15 +241,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -283,17 +256,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -303,41 +271,37 @@ public string? InvoiceGroupingKey { get { - if (!this.Properties.TryGetValue("invoice_grouping_key", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoice_grouping_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoice_grouping_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoice_grouping_key"] = JsonSerializer.SerializeToElement(value); } } /// /// Within each billing cycle, specifies the cadence at which invoices are produced. /// If unspecified, a single invoice is produced per billing cycle. /// - public Models::NewBillingCycleConfiguration? InvoicingCycleConfiguration + public NewBillingCycleConfiguration? InvoicingCycleConfiguration { get { if ( !this.Properties.TryGetValue( "invoicing_cycle_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["invoicing_cycle_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["invoicing_cycle_configuration"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -346,16 +310,16 @@ public string? InvoiceGroupingKey /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -366,12 +330,12 @@ public string? ReferenceID { get { - if (!this.Properties.TryGetValue("reference_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reference_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reference_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reference_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -408,15 +372,15 @@ public override void Validate() public NewSubscriptionUnitWithProrationPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - NewSubscriptionUnitWithProrationPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + NewSubscriptionUnitWithProrationPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static NewSubscriptionUnitWithProrationPrice FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/Cadence.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/Cadence.cs index 40163e86..b3fb8fc6 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/Cadence.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/Cadence.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties; /// /// The cadence to bill for this price on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Cadence(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Cadence(string value) : IEnum { public static readonly Cadence Annual = new("annual"); @@ -43,7 +42,7 @@ public Value Known() => "quarterly" => Value.Quarterly, "one_time" => Value.OneTime, "custom" => Value.Custom, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfig.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfig.cs index d1fc6acf..1a136311 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfig.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfig.cs @@ -1,25 +1,21 @@ +using System.Text.Json.Serialization; using ConversionRateConfigVariants = Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties.ConversionRateConfigVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties; /// /// The configuration for the rate of the price currency to the invoicing currency. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class ConversionRateConfig { internal ConversionRateConfig() { } - public static ConversionRateConfigVariants::UnitConversionRateConfig Create( - Models::UnitConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(UnitConversionRateConfig value) => + new ConversionRateConfigVariants::UnitConversionRateConfigVariant(value); - public static ConversionRateConfigVariants::TieredConversionRateConfig Create( - Models::TieredConversionRateConfig value - ) => new(value); + public static implicit operator ConversionRateConfig(TieredConversionRateConfig value) => + new ConversionRateConfigVariants::TieredConversionRateConfigVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs index 421a91c9..966694d0 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ConversionRateConfigVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using NewSubscriptionUnitWithProrationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties.ConversionRateConfigVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UnitConversionRateConfig(Models::UnitConversionRateConfig Value) - : NewSubscriptionUnitWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UnitConversionRateConfigVariant(UnitConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static UnitConversionRateConfig From(Models::UnitConversionRateConfig value) + public static UnitConversionRateConfigVariant From(UnitConversionRateConfig value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class TieredConversionRateConfig(Models::TieredConversionRateConfig Value) - : NewSubscriptionUnitWithProrationPriceProperties::ConversionRateConfig, - Orb::IVariant +public sealed record class TieredConversionRateConfigVariant(TieredConversionRateConfig Value) + : ConversionRateConfig, + IVariant { - public static TieredConversionRateConfig From(Models::TieredConversionRateConfig value) + public static TieredConversionRateConfigVariant From(TieredConversionRateConfig value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ModelType.cs b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ModelType.cs index f4f9c707..e3774e9a 100644 --- a/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ModelType.cs +++ b/src/Orb/Models/Subscriptions/NewSubscriptionUnitWithProrationPriceProperties/ModelType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.NewSubscriptionUnitWithProrationPriceProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ModelType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ModelType(string value) : IEnum { public static readonly ModelType UnitWithProration = new("unit_with_proration"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit_with_proration" => Value.UnitWithProration, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/Subscription.cs b/src/Orb/Models/Subscriptions/Subscription.cs index 4f8d6d74..ab67b9cf 100644 --- a/src/Orb/Models/Subscriptions/Subscription.cs +++ b/src/Orb/Models/Subscriptions/Subscription.cs @@ -1,11 +1,10 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Customers = Orb.Models.Customers; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; using Plans = Orb.Models.Plans; -using Serialization = System.Text.Json.Serialization; using SubscriptionProperties = Orb.Models.Subscriptions.SubscriptionProperties; using System = System; @@ -31,20 +30,20 @@ namespace Orb.Models.Subscriptions; /// to contain usage-based charges for the previous period, and a recurring fee for /// the following period. /// -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Subscription : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Subscription : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("id", out JsonElement element)) throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,24 +53,17 @@ public required long? ActivePlanPhaseOrder { get { - if ( - !this.Properties.TryGetValue( - "active_plan_phase_order", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("active_plan_phase_order", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "active_plan_phase_order", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["active_plan_phase_order"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["active_plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } @@ -79,26 +71,20 @@ public required long? ActivePlanPhaseOrder /// The adjustment intervals for this subscription sorted by the start_date of /// the adjustment interval. /// - public required Generic::List AdjustmentIntervals + public required List AdjustmentIntervals { get { - if (!this.Properties.TryGetValue("adjustment_intervals", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("adjustment_intervals", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("adjustment_intervals"); - } - set - { - this.Properties["adjustment_intervals"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("adjustment_intervals"); } + set { this.Properties["adjustment_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,15 +96,15 @@ public required bool? AutoCollection { get { - if (!this.Properties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("auto_collection", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "auto_collection", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public required Models::BillingCycleAnchorConfiguration BillingCycleAnchorConfiguration @@ -128,7 +114,7 @@ public required bool? AutoCollection if ( !this.Properties.TryGetValue( "billing_cycle_anchor_configuration", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -136,14 +122,13 @@ public required bool? AutoCollection "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("billing_cycle_anchor_configuration"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("billing_cycle_anchor_configuration"); } set { this.Properties["billing_cycle_anchor_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -157,33 +142,30 @@ public required long BillingCycleDay { get { - if (!this.Properties.TryGetValue("billing_cycle_day", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billing_cycle_day", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "billing_cycle_day", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billing_cycle_day"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billing_cycle_day"] = JsonSerializer.SerializeToElement(value); } } public required System::DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "created_at", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } /// @@ -198,7 +180,7 @@ public required long BillingCycleDay if ( !this.Properties.TryGetValue( "current_billing_period_end_date", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -206,12 +188,13 @@ public required long BillingCycleDay "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["current_billing_period_end_date"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["current_billing_period_end_date"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -227,7 +210,7 @@ public required long BillingCycleDay if ( !this.Properties.TryGetValue( "current_billing_period_start_date", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -235,12 +218,12 @@ public required long BillingCycleDay "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.Properties["current_billing_period_start_date"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -265,16 +248,16 @@ public required long BillingCycleDay { get { - if (!this.Properties.TryGetValue("customer", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("customer", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "customer", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("customer"); } - set { this.Properties["customer"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); } } /// @@ -285,44 +268,36 @@ public required string? DefaultInvoiceMemo { get { - if (!this.Properties.TryGetValue("default_invoice_memo", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("default_invoice_memo", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "default_invoice_memo", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } /// /// The discount intervals for this subscription sorted by the start_date. This /// field is deprecated in favor of `adjustment_intervals`. /// - public required Generic::List DiscountIntervals + public required List DiscountIntervals { get { - if (!this.Properties.TryGetValue("discount_intervals", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_intervals", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element ) ?? throw new System::ArgumentNullException("discount_intervals"); } - set - { - this.Properties["discount_intervals"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["discount_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -332,40 +307,37 @@ public required string? DefaultInvoiceMemo { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List FixedFeeQuantitySchedule + public required List FixedFeeQuantitySchedule { get { if ( - !this.Properties.TryGetValue( - "fixed_fee_quantity_schedule", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("fixed_fee_quantity_schedule", out JsonElement element) ) throw new System::ArgumentOutOfRangeException( "fixed_fee_quantity_schedule", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("fixed_fee_quantity_schedule"); + return JsonSerializer.Deserialize>(element) + ?? throw new System::ArgumentNullException("fixed_fee_quantity_schedule"); } set { - this.Properties["fixed_fee_quantity_schedule"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["fixed_fee_quantity_schedule"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -373,41 +345,35 @@ public required string? InvoicingThreshold { get { - if (!this.Properties.TryGetValue("invoicing_threshold", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("invoicing_threshold", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "invoicing_threshold", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["invoicing_threshold"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["invoicing_threshold"] = JsonSerializer.SerializeToElement(value); } } /// /// The maximum intervals for this subscription sorted by the start_date. This /// field is deprecated in favor of `adjustment_intervals`. /// - public required Generic::List MaximumIntervals + public required List MaximumIntervals { get { - if (!this.Properties.TryGetValue("maximum_intervals", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_intervals", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "maximum_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("maximum_intervals"); } - set - { - this.Properties["maximum_intervals"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["maximum_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -416,43 +382,40 @@ public required string? InvoicingThreshold /// to `null`, and the entire metadata mapping can be cleared by setting `metadata` /// to `null`. /// - public required Generic::Dictionary Metadata + public required Dictionary Metadata { get { - if (!this.Properties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("metadata"); } - set { this.Properties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// /// The minimum intervals for this subscription sorted by the start_date. This /// field is deprecated in favor of `adjustment_intervals`. /// - public required Generic::List MinimumIntervals + public required List MinimumIntervals { get { - if (!this.Properties.TryGetValue("minimum_intervals", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_intervals", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "minimum_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("minimum_intervals"); } - set - { - this.Properties["minimum_intervals"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["minimum_intervals"] = JsonSerializer.SerializeToElement(value); } } /// @@ -462,13 +425,13 @@ public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -481,15 +444,15 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("net_terms", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "net_terms", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["net_terms"] = JsonSerializer.SerializeToElement(value); } } /// @@ -500,22 +463,20 @@ public required long NetTerms get { if ( - !this.Properties.TryGetValue( - "pending_subscription_change", - out Json::JsonElement element - ) + !this.Properties.TryGetValue("pending_subscription_change", out JsonElement element) ) throw new System::ArgumentOutOfRangeException( "pending_subscription_change", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["pending_subscription_change"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["pending_subscription_change"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -528,46 +489,46 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("plan", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan", out JsonElement element)) throw new System::ArgumentOutOfRangeException("plan", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["plan"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan"] = JsonSerializer.SerializeToElement(value); } } /// /// The price intervals for this subscription. /// - public required Generic::List PriceIntervals + public required List PriceIntervals { get { - if (!this.Properties.TryGetValue("price_intervals", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_intervals", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_intervals", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("price_intervals"); } - set { this.Properties["price_intervals"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_intervals"] = JsonSerializer.SerializeToElement(value); } } public required Models::CouponRedemption? RedeemedCoupon { get { - if (!this.Properties.TryGetValue("redeemed_coupon", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("redeemed_coupon", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "redeemed_coupon", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["redeemed_coupon"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["redeemed_coupon"] = JsonSerializer.SerializeToElement(value); } } /// @@ -577,47 +538,47 @@ public required long NetTerms { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public required SubscriptionProperties::Status Status { get { - if (!this.Properties.TryGetValue("status", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("status", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "status", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("status"); } - set { this.Properties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["status"] = JsonSerializer.SerializeToElement(value); } } public required Models::SubscriptionTrialInfo TrialInfo { get { - if (!this.Properties.TryGetValue("trial_info", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("trial_info", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "trial_info", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("trial_info"); } - set { this.Properties["trial_info"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["trial_info"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -675,16 +636,14 @@ public override void Validate() public Subscription() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Subscription(Generic::Dictionary properties) + [SetsRequiredMembers] + Subscription(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Subscription FromRawUnchecked( - Generic::Dictionary properties - ) + public static Subscription FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCancelParams.cs b/src/Orb/Models/Subscriptions/SubscriptionCancelParams.cs index d167bb9b..a829d681 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCancelParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCancelParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using SubscriptionCancelParamsProperties = Orb.Models.Subscriptions.SubscriptionCancelParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -60,9 +59,9 @@ namespace Orb.Models.Subscriptions; /// recently issued invoice, Orb will void the intervening invoice and generate a /// new one based on the new dates for the subscription. See the section on [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors). /// -public sealed record class SubscriptionCancelParams : Orb::ParamsBase +public sealed record class SubscriptionCancelParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -73,20 +72,17 @@ public sealed record class SubscriptionCancelParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("cancel_option", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("cancel_option", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "cancel_option", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("cancel_option"); } - set - { - this.BodyProperties["cancel_option"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["cancel_option"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,17 +97,18 @@ public bool? AllowInvoiceCreditOrVoid if ( !this.BodyProperties.TryGetValue( "allow_invoice_credit_or_void", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["allow_invoice_credit_or_void"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["allow_invoice_credit_or_void"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -123,22 +120,15 @@ public bool? AllowInvoiceCreditOrVoid { get { - if ( - !this.BodyProperties.TryGetValue("cancellation_date", out Json::JsonElement element) - ) + if (!this.BodyProperties.TryGetValue("cancellation_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["cancellation_date"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["cancellation_date"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -149,21 +139,21 @@ public bool? AllowInvoiceCreditOrVoid }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCancelParamsProperties/CancelOption.cs b/src/Orb/Models/Subscriptions/SubscriptionCancelParamsProperties/CancelOption.cs index f90bee87..58c730b5 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCancelParamsProperties/CancelOption.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCancelParamsProperties/CancelOption.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCancelParamsProperties; /// /// Determines the timing of subscription cancellation /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class CancelOption(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class CancelOption(string value) : IEnum { public static readonly CancelOption EndOfSubscriptionTerm = new("end_of_subscription_term"); @@ -31,7 +30,7 @@ public Value Known() => "end_of_subscription_term" => Value.EndOfSubscriptionTerm, "immediate" => Value.Immediate, "requested_date" => Value.RequestedDate, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParams.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParams.cs index 4b1d3233..af7235d2 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParams.cs @@ -1,11 +1,10 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using Models = Orb.Models; -using Orb = Orb; using SubscriptionCreateParamsProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -199,47 +198,44 @@ namespace Orb.Models.Subscriptions; /// E.g. pass in `10.00` to issue an invoice when usage amounts hit \$10.00 for a /// subscription that invoices in USD. /// -public sealed record class SubscriptionCreateParams : Orb::ParamsBase +public sealed record class SubscriptionCreateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; /// /// Additional adjustments to be added to the subscription. (Only available for /// accounts that have migrated off of legacy subscription overrides) /// - public Generic::List? AddAdjustments + public List? AddAdjustments { get { - if (!this.BodyProperties.TryGetValue("add_adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["add_adjustments"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["add_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional prices to be added to the subscription. (Only available for accounts /// that have migrated off of legacy subscription overrides) /// - public Generic::List? AddPrices + public List? AddPrices { get { - if (!this.BodyProperties.TryGetValue("add_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["add_prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["add_prices"] = JsonSerializer.SerializeToElement(value); } } public bool? AlignBillingWithSubscriptionStartDate @@ -249,17 +245,17 @@ public bool? AlignBillingWithSubscriptionStartDate if ( !this.BodyProperties.TryGetValue( "align_billing_with_subscription_start_date", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["align_billing_with_subscription_start_date"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -272,27 +268,24 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("auto_collection", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } public string? AwsRegion { get { - if (!this.BodyProperties.TryGetValue("aws_region", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("aws_region", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["aws_region"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["aws_region"] = JsonSerializer.SerializeToElement(value); } } public Models::BillingCycleAnchorConfiguration? BillingCycleAnchorConfiguration @@ -302,19 +295,17 @@ public string? AwsRegion if ( !this.BodyProperties.TryGetValue( "billing_cycle_anchor_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["billing_cycle_anchor_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -327,19 +318,14 @@ public string? CouponRedemptionCode { get { - if ( - !this.BodyProperties.TryGetValue( - "coupon_redemption_code", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("coupon_redemption_code", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["coupon_redemption_code"] = Json::JsonSerializer.SerializeToElement( + this.BodyProperties["coupon_redemption_code"] = JsonSerializer.SerializeToElement( value ); } @@ -349,21 +335,14 @@ public double? CreditsOverageRate { get { - if ( - !this.BodyProperties.TryGetValue( - "credits_overage_rate", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("credits_overage_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["credits_overage_rate"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["credits_overage_rate"] = JsonSerializer.SerializeToElement(value); } } @@ -375,24 +354,24 @@ public string? Currency { get { - if (!this.BodyProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); } } public string? CustomerID { get { - if (!this.BodyProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -403,21 +382,14 @@ public string? DefaultInvoiceMemo { get { - if ( - !this.BodyProperties.TryGetValue( - "default_invoice_memo", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("default_invoice_memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } @@ -425,33 +397,26 @@ public string? DefaultInvoiceMemo { get { - if (!this.BodyProperties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["end_date"] = JsonSerializer.SerializeToElement(value); } } public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -459,23 +424,16 @@ public string? ExternalCustomerID { get { - if ( - !this.BodyProperties.TryGetValue( - "external_marketplace", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("external_marketplace", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.BodyProperties["external_marketplace"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["external_marketplace"] = JsonSerializer.SerializeToElement(value); } } @@ -486,17 +444,17 @@ public string? ExternalMarketplaceReportingID if ( !this.BodyProperties.TryGetValue( "external_marketplace_reporting_id", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["external_marketplace_reporting_id"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -508,17 +466,12 @@ public string? ExternalPlanID { get { - if (!this.BodyProperties.TryGetValue("external_plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("external_plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["external_plan_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -530,12 +483,12 @@ public string? Filter { get { - if (!this.BodyProperties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["filter"] = JsonSerializer.SerializeToElement(value); } } /// @@ -545,21 +498,14 @@ public long? InitialPhaseOrder { get { - if ( - !this.BodyProperties.TryGetValue( - "initial_phase_order", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("initial_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["initial_phase_order"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["initial_phase_order"] = JsonSerializer.SerializeToElement(value); } } @@ -572,21 +518,14 @@ public string? InvoicingThreshold { get { - if ( - !this.BodyProperties.TryGetValue( - "invoicing_threshold", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("invoicing_threshold", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["invoicing_threshold"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["invoicing_threshold"] = JsonSerializer.SerializeToElement(value); } } @@ -595,16 +534,16 @@ public string? InvoicingThreshold /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -614,12 +553,12 @@ public string? Name { get { - if (!this.BodyProperties.TryGetValue("name", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("name", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["name"] = JsonSerializer.SerializeToElement(value); } } /// @@ -631,12 +570,12 @@ public long? NetTerms { get { - if (!this.BodyProperties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("net_terms", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["net_terms"] = JsonSerializer.SerializeToElement(value); } } public double? PerCreditOverageAmount @@ -646,17 +585,18 @@ public double? PerCreditOverageAmount if ( !this.BodyProperties.TryGetValue( "per_credit_overage_amount", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["per_credit_overage_amount"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["per_credit_overage_amount"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -668,12 +608,12 @@ public string? PlanID { get { - if (!this.BodyProperties.TryGetValue("plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["plan_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -684,67 +624,50 @@ public long? PlanVersionNumber { get { - if ( - !this.BodyProperties.TryGetValue( - "plan_version_number", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("plan_version_number", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["plan_version_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["plan_version_number"] = JsonSerializer.SerializeToElement(value); } } /// /// Optionally provide a list of overrides for prices on the plan /// - public Generic::List? PriceOverrides + public List? PriceOverrides { get { - if (!this.BodyProperties.TryGetValue("price_overrides", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("price_overrides", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.BodyProperties["price_overrides"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.BodyProperties["price_overrides"] = JsonSerializer.SerializeToElement(value); } } /// /// Plan adjustments to be removed from the subscription. (Only available for accounts /// that have migrated off of legacy subscription overrides) /// - public Generic::List? RemoveAdjustments + public List? RemoveAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "remove_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("remove_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["remove_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["remove_adjustments"] = JsonSerializer.SerializeToElement(value); } } @@ -752,48 +675,38 @@ public long? PlanVersionNumber /// Plan prices to be removed from the subscription. (Only available for accounts /// that have migrated off of legacy subscription overrides) /// - public Generic::List? RemovePrices + public List? RemovePrices { get { - if (!this.BodyProperties.TryGetValue("remove_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("remove_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["remove_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["remove_prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Plan adjustments to be replaced with additional adjustments on the subscription. /// (Only available for accounts that have migrated off of legacy subscription overrides) /// - public Generic::List? ReplaceAdjustments + public List? ReplaceAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "replace_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("replace_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["replace_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["replace_adjustments"] = JsonSerializer.SerializeToElement(value); } } @@ -801,33 +714,30 @@ public long? PlanVersionNumber /// Plan prices to be replaced with additional prices on the subscription. (Only /// available for accounts that have migrated off of legacy subscription overrides) /// - public Generic::List? ReplacePrices + public List? ReplacePrices { get { - if (!this.BodyProperties.TryGetValue("replace_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("replace_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["replace_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["replace_prices"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? StartDate { get { - if (!this.BodyProperties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -839,21 +749,14 @@ public long? TrialDurationDays { get { - if ( - !this.BodyProperties.TryGetValue( - "trial_duration_days", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("trial_duration_days", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["trial_duration_days"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["trial_duration_days"] = JsonSerializer.SerializeToElement(value); } } @@ -865,29 +768,22 @@ public long? TrialDurationDays /// usage_customer_ids must be either the customer for this subscription itself, /// or any of that customer's children. /// - public Generic::List? UsageCustomerIDs + public List? UsageCustomerIDs { get { - if ( - !this.BodyProperties.TryGetValue( - "usage_customer_ids", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("usage_customer_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } set { - this.BodyProperties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/subscriptions") { @@ -895,21 +791,21 @@ public long? TrialDurationDays }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustment.cs index ca0f4628..15f2e665 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustment.cs @@ -1,15 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddAdjustmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the subscription. @@ -18,32 +17,29 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element) - ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// /// The end date of the adjustment interval. This is the date that the adjustment /// will stop affecting prices on the subscription. /// - public System::DateTime? EndDate + public DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,15 +49,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -69,16 +62,16 @@ public long? PlanPhaseOrder /// will start affecting prices on the subscription. If null, the adjustment will /// start when the phase or subscription starts. /// - public System::DateTime? StartDate + public DateTime? StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -92,16 +85,14 @@ public override void Validate() public AddAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + AddAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/Adjustment.cs index ad97f7cb..a3648587 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs index fcfcbf1a..67967897 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPrice.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPrice.cs index f8297abd..a5da1bf9 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPrice.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPrice.cs @@ -1,67 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddPriceProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddPrice : ModelBase, IFromRaw { /// /// The definition of a new allocation price to create and add to the subscription. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// /// [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this price. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// /// The end date of the price interval. This is the date that the price will stop /// billing on the subscription. If null, billing will end when the phase or subscription ends. /// - public System::DateTime? EndDate + public DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,15 +63,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +79,12 @@ public string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,12 +95,12 @@ public string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,30 +110,27 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new price to create and add to the subscription. /// - public AddPriceProperties::Price? Price + public AddPriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,12 +140,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -167,16 +153,16 @@ public string? PriceID /// start billing on the subscription. If null, billing will start when the phase /// or subscription starts. /// - public System::DateTime? StartDate + public DateTime? StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -199,16 +185,14 @@ public override void Validate() public AddPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + AddPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/Price.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/Price.cs deleted file mode 100644 index d21a34a5..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/Price.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Orb = Orb; -using PriceVariants = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; - -namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties; - -/// -/// The definition of a new price to create and add to the subscription. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewSubscriptionUnitPrice Create( - Subscriptions::NewSubscriptionUnitPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackagePrice Create( - Subscriptions::NewSubscriptionPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixPrice Create( - Subscriptions::NewSubscriptionMatrixPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPrice Create( - Subscriptions::NewSubscriptionTieredPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredBPSPrice Create( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBPSPrice Create( - Subscriptions::NewSubscriptionBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkBPSPrice Create( - Subscriptions::NewSubscriptionBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkPrice Create( - Subscriptions::NewSubscriptionBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionThresholdTotalAmountPrice Create( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackagePrice Create( - Subscriptions::NewSubscriptionTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithPercentPrice Create( - Subscriptions::NewSubscriptionUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackageWithAllocationPrice Create( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTierWithProrationPrice Create( - Subscriptions::NewSubscriptionTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithProrationPrice Create( - Subscriptions::NewSubscriptionUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedAllocationPrice Create( - Subscriptions::NewSubscriptionGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithProratedMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkWithProrationPrice Create( - Subscriptions::NewSubscriptionBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionCumulativeGroupedBulkPrice Create( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMaxGroupTieredPackagePrice Create( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithDisplayNamePrice Create( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPackagePrice Create( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithAllocationPrice Create( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackageWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPrice Create( - Subscriptions::NewSubscriptionGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/Price1.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/Price1.cs new file mode 100644 index 00000000..8bdf117c --- /dev/null +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/Price1.cs @@ -0,0 +1,101 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties.PriceVariants; + +namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties; + +/// +/// The definition of a new price to create and add to the subscription. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewSubscriptionUnitPrice value) => + new PriceVariants::NewSubscriptionUnitPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackagePrice value) => + new PriceVariants::NewSubscriptionPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixPrice value) => + new PriceVariants::NewSubscriptionMatrixPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPrice value) => + new PriceVariants::NewSubscriptionTieredPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredBPSPrice value) => + new PriceVariants::NewSubscriptionTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBPSPrice value) => + new PriceVariants::NewSubscriptionBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkBPSPrice value) => + new PriceVariants::NewSubscriptionBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkPrice value) => + new PriceVariants::NewSubscriptionBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionThresholdTotalAmountPrice value) => + new PriceVariants::NewSubscriptionThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackagePrice value) => + new PriceVariants::NewSubscriptionTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithPercentPrice value) => + new PriceVariants::NewSubscriptionUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackageWithAllocationPrice value) => + new PriceVariants::NewSubscriptionPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTierWithProrationPrice value) => + new PriceVariants::NewSubscriptionTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithProrationPrice value) => + new PriceVariants::NewSubscriptionUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedAllocationPrice value) => + new PriceVariants::NewSubscriptionGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkWithProrationPrice value) => + new PriceVariants::NewSubscriptionBulkWithProrationPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithUnitPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithTieredPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionCumulativeGroupedBulkPrice value) => + new PriceVariants::NewSubscriptionCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMaxGroupTieredPackagePrice value) => + new PriceVariants::NewSubscriptionMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithDisplayNamePrice value) => + new PriceVariants::NewSubscriptionMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPackagePrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithAllocationPrice value) => + new PriceVariants::NewSubscriptionMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackageWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/PriceVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/PriceVariants/All.cs index 5012069c..8d551f8e 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/AddPriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using AddPriceProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionUnitPrice(Subscriptions::NewSubscriptionUnitPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionUnitPriceVariant(NewSubscriptionUnitPrice Value) + : Price1, + IVariant { - public static NewSubscriptionUnitPrice From(Subscriptions::NewSubscriptionUnitPrice value) + public static NewSubscriptionUnitPriceVariant From(NewSubscriptionUnitPrice value) { return new(value); } @@ -23,19 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackagePrice, - Subscriptions::NewSubscriptionPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionPackagePrice( - Subscriptions::NewSubscriptionPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionPackagePriceVariant(NewSubscriptionPackagePrice Value) + : Price1, + IVariant { - public static NewSubscriptionPackagePrice From(Subscriptions::NewSubscriptionPackagePrice value) + public static NewSubscriptionPackagePriceVariant From(NewSubscriptionPackagePrice value) { return new(value); } @@ -46,19 +36,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixPrice, - Subscriptions::NewSubscriptionMatrixPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionMatrixPrice( - Subscriptions::NewSubscriptionMatrixPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionMatrixPriceVariant(NewSubscriptionMatrixPrice Value) + : Price1, + IVariant { - public static NewSubscriptionMatrixPrice From(Subscriptions::NewSubscriptionMatrixPrice value) + public static NewSubscriptionMatrixPriceVariant From(NewSubscriptionMatrixPrice value) { return new(value); } @@ -69,19 +54,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPrice, - Subscriptions::NewSubscriptionTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredPrice( - Subscriptions::NewSubscriptionTieredPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredPriceVariant(NewSubscriptionTieredPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredPrice From(Subscriptions::NewSubscriptionTieredPrice value) + public static NewSubscriptionTieredPriceVariant From(NewSubscriptionTieredPrice value) { return new(value); } @@ -92,21 +72,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredBPSPrice, - Subscriptions::NewSubscriptionTieredBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredBPSPrice( - Subscriptions::NewSubscriptionTieredBPSPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredBPSPriceVariant(NewSubscriptionTieredBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredBPSPrice From( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) + public static NewSubscriptionTieredBPSPriceVariant From(NewSubscriptionTieredBPSPrice value) { return new(value); } @@ -117,14 +90,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBPSPrice(Subscriptions::NewSubscriptionBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBPSPriceVariant(NewSubscriptionBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBPSPrice From(Subscriptions::NewSubscriptionBPSPrice value) + public static NewSubscriptionBPSPriceVariant From(NewSubscriptionBPSPrice value) { return new(value); } @@ -135,19 +106,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkBPSPrice, - Subscriptions::NewSubscriptionBulkBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionBulkBPSPrice( - Subscriptions::NewSubscriptionBulkBPSPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionBulkBPSPriceVariant(NewSubscriptionBulkBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkBPSPrice From(Subscriptions::NewSubscriptionBulkBPSPrice value) + public static NewSubscriptionBulkBPSPriceVariant From(NewSubscriptionBulkBPSPrice value) { return new(value); } @@ -158,14 +124,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBulkPrice(Subscriptions::NewSubscriptionBulkPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBulkPriceVariant(NewSubscriptionBulkPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkPrice From(Subscriptions::NewSubscriptionBulkPrice value) + public static NewSubscriptionBulkPriceVariant From(NewSubscriptionBulkPrice value) { return new(value); } @@ -176,23 +140,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice >) )] -public sealed record class NewSubscriptionThresholdTotalAmountPrice( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice Value +public sealed record class NewSubscriptionThresholdTotalAmountPriceVariant( + NewSubscriptionThresholdTotalAmountPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice + : Price1, + IVariant< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice > { - public static NewSubscriptionThresholdTotalAmountPrice From( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value + public static NewSubscriptionThresholdTotalAmountPriceVariant From( + NewSubscriptionThresholdTotalAmountPrice value ) { return new(value); @@ -204,23 +168,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackagePriceVariant, + NewSubscriptionTieredPackagePrice >) )] -public sealed record class NewSubscriptionTieredPackagePrice( - Subscriptions::NewSubscriptionTieredPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice - > +public sealed record class NewSubscriptionTieredPackagePriceVariant( + NewSubscriptionTieredPackagePrice Value +) : Price1, IVariant { - public static NewSubscriptionTieredPackagePrice From( - Subscriptions::NewSubscriptionTieredPackagePrice value + public static NewSubscriptionTieredPackagePriceVariant From( + NewSubscriptionTieredPackagePrice value ) { return new(value); @@ -232,23 +191,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredWithMinimumPrice( - Subscriptions::NewSubscriptionTieredWithMinimumPrice Value +public sealed record class NewSubscriptionTieredWithMinimumPriceVariant( + NewSubscriptionTieredWithMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice > { - public static NewSubscriptionTieredWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value + public static NewSubscriptionTieredWithMinimumPriceVariant From( + NewSubscriptionTieredWithMinimumPrice value ) { return new(value); @@ -260,23 +219,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithPercentPriceVariant, + NewSubscriptionUnitWithPercentPrice >) )] -public sealed record class NewSubscriptionUnitWithPercentPrice( - Subscriptions::NewSubscriptionUnitWithPercentPrice Value +public sealed record class NewSubscriptionUnitWithPercentPriceVariant( + NewSubscriptionUnitWithPercentPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice - > + : Price1, + IVariant { - public static NewSubscriptionUnitWithPercentPrice From( - Subscriptions::NewSubscriptionUnitWithPercentPrice value + public static NewSubscriptionUnitWithPercentPriceVariant From( + NewSubscriptionUnitWithPercentPrice value ) { return new(value); @@ -288,23 +244,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice >) )] -public sealed record class NewSubscriptionPackageWithAllocationPrice( - Subscriptions::NewSubscriptionPackageWithAllocationPrice Value +public sealed record class NewSubscriptionPackageWithAllocationPriceVariant( + NewSubscriptionPackageWithAllocationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice > { - public static NewSubscriptionPackageWithAllocationPrice From( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value + public static NewSubscriptionPackageWithAllocationPriceVariant From( + NewSubscriptionPackageWithAllocationPrice value ) { return new(value); @@ -316,23 +272,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice >) )] -public sealed record class NewSubscriptionTierWithProrationPrice( - Subscriptions::NewSubscriptionTierWithProrationPrice Value +public sealed record class NewSubscriptionTierWithProrationPriceVariant( + NewSubscriptionTierWithProrationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice + : Price1, + IVariant< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice > { - public static NewSubscriptionTierWithProrationPrice From( - Subscriptions::NewSubscriptionTierWithProrationPrice value + public static NewSubscriptionTierWithProrationPriceVariant From( + NewSubscriptionTierWithProrationPrice value ) { return new(value); @@ -344,23 +300,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice >) )] -public sealed record class NewSubscriptionUnitWithProrationPrice( - Subscriptions::NewSubscriptionUnitWithProrationPrice Value +public sealed record class NewSubscriptionUnitWithProrationPriceVariant( + NewSubscriptionUnitWithProrationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice + : Price1, + IVariant< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice > { - public static NewSubscriptionUnitWithProrationPrice From( - Subscriptions::NewSubscriptionUnitWithProrationPrice value + public static NewSubscriptionUnitWithProrationPriceVariant From( + NewSubscriptionUnitWithProrationPrice value ) { return new(value); @@ -372,23 +328,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice >) )] -public sealed record class NewSubscriptionGroupedAllocationPrice( - Subscriptions::NewSubscriptionGroupedAllocationPrice Value +public sealed record class NewSubscriptionGroupedAllocationPriceVariant( + NewSubscriptionGroupedAllocationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice + : Price1, + IVariant< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice > { - public static NewSubscriptionGroupedAllocationPrice From( - Subscriptions::NewSubscriptionGroupedAllocationPrice value + public static NewSubscriptionGroupedAllocationPriceVariant From( + NewSubscriptionGroupedAllocationPrice value ) { return new(value); @@ -400,23 +356,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithProratedMinimumPriceVariant( + NewSubscriptionGroupedWithProratedMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice > { - public static NewSubscriptionGroupedWithProratedMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value + public static NewSubscriptionGroupedWithProratedMinimumPriceVariant From( + NewSubscriptionGroupedWithProratedMinimumPrice value ) { return new(value); @@ -428,23 +384,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice >) )] -public sealed record class NewSubscriptionBulkWithProrationPrice( - Subscriptions::NewSubscriptionBulkWithProrationPrice Value +public sealed record class NewSubscriptionBulkWithProrationPriceVariant( + NewSubscriptionBulkWithProrationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice + : Price1, + IVariant< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice > { - public static NewSubscriptionBulkWithProrationPrice From( - Subscriptions::NewSubscriptionBulkWithProrationPrice value + public static NewSubscriptionBulkWithProrationPriceVariant From( + NewSubscriptionBulkWithProrationPrice value ) { return new(value); @@ -456,23 +412,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPriceVariant( + NewSubscriptionScalableMatrixWithUnitPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice > { - public static NewSubscriptionScalableMatrixWithUnitPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value + public static NewSubscriptionScalableMatrixWithUnitPricingPriceVariant From( + NewSubscriptionScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -484,23 +440,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPriceVariant( + NewSubscriptionScalableMatrixWithTieredPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice > { - public static NewSubscriptionScalableMatrixWithTieredPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value + public static NewSubscriptionScalableMatrixWithTieredPricingPriceVariant From( + NewSubscriptionScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -512,23 +468,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice >) )] -public sealed record class NewSubscriptionCumulativeGroupedBulkPrice( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice Value +public sealed record class NewSubscriptionCumulativeGroupedBulkPriceVariant( + NewSubscriptionCumulativeGroupedBulkPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice > { - public static NewSubscriptionCumulativeGroupedBulkPrice From( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value + public static NewSubscriptionCumulativeGroupedBulkPriceVariant From( + NewSubscriptionCumulativeGroupedBulkPrice value ) { return new(value); @@ -540,23 +496,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice >) )] -public sealed record class NewSubscriptionMaxGroupTieredPackagePrice( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice Value +public sealed record class NewSubscriptionMaxGroupTieredPackagePriceVariant( + NewSubscriptionMaxGroupTieredPackagePrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice > { - public static NewSubscriptionMaxGroupTieredPackagePrice From( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value + public static NewSubscriptionMaxGroupTieredPackagePriceVariant From( + NewSubscriptionMaxGroupTieredPackagePrice value ) { return new(value); @@ -568,23 +524,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithMeteredMinimumPriceVariant( + NewSubscriptionGroupedWithMeteredMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice > { - public static NewSubscriptionGroupedWithMeteredMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value + public static NewSubscriptionGroupedWithMeteredMinimumPriceVariant From( + NewSubscriptionGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -596,23 +552,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice >) )] -public sealed record class NewSubscriptionMatrixWithDisplayNamePrice( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice Value +public sealed record class NewSubscriptionMatrixWithDisplayNamePriceVariant( + NewSubscriptionMatrixWithDisplayNamePrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice > { - public static NewSubscriptionMatrixWithDisplayNamePrice From( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value + public static NewSubscriptionMatrixWithDisplayNamePriceVariant From( + NewSubscriptionMatrixWithDisplayNamePrice value ) { return new(value); @@ -624,23 +580,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice >) )] -public sealed record class NewSubscriptionGroupedTieredPackagePrice( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice Value +public sealed record class NewSubscriptionGroupedTieredPackagePriceVariant( + NewSubscriptionGroupedTieredPackagePrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice > { - public static NewSubscriptionGroupedTieredPackagePrice From( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value + public static NewSubscriptionGroupedTieredPackagePriceVariant From( + NewSubscriptionGroupedTieredPackagePrice value ) { return new(value); @@ -652,23 +608,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice >) )] -public sealed record class NewSubscriptionMatrixWithAllocationPrice( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice Value +public sealed record class NewSubscriptionMatrixWithAllocationPriceVariant( + NewSubscriptionMatrixWithAllocationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice > { - public static NewSubscriptionMatrixWithAllocationPrice From( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value + public static NewSubscriptionMatrixWithAllocationPriceVariant From( + NewSubscriptionMatrixWithAllocationPrice value ) { return new(value); @@ -680,23 +636,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredPackageWithMinimumPrice( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice Value +public sealed record class NewSubscriptionTieredPackageWithMinimumPriceVariant( + NewSubscriptionTieredPackageWithMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice > { - public static NewSubscriptionTieredPackageWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value + public static NewSubscriptionTieredPackageWithMinimumPriceVariant From( + NewSubscriptionTieredPackageWithMinimumPrice value ) { return new(value); @@ -708,23 +664,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPriceVariant, + NewSubscriptionGroupedTieredPrice >) )] -public sealed record class NewSubscriptionGroupedTieredPrice( - Subscriptions::NewSubscriptionGroupedTieredPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice - > +public sealed record class NewSubscriptionGroupedTieredPriceVariant( + NewSubscriptionGroupedTieredPrice Value +) : Price1, IVariant { - public static NewSubscriptionGroupedTieredPrice From( - Subscriptions::NewSubscriptionGroupedTieredPrice value + public static NewSubscriptionGroupedTieredPriceVariant From( + NewSubscriptionGroupedTieredPrice value ) { return new(value); diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ExternalMarketplace.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ExternalMarketplace.cs index 8e392435..e2651f69 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ExternalMarketplace.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ExternalMarketplace.cs @@ -1,12 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ExternalMarketplace(string value) - : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ExternalMarketplace(string value) : IEnum { public static readonly ExternalMarketplace Google = new("google"); @@ -29,7 +27,7 @@ public Value Known() => "google" => Value.Google, "aws" => Value.Aws, "azure" => Value.Azure, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemoveAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemoveAdjustment.cs index 440e4adf..fec3f74d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemoveAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemoveAdjustment.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemoveAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemoveAdjustment : ModelBase, IFromRaw { /// /// The id of the adjustment to remove on the subscription. @@ -17,16 +16,13 @@ public required string AdjustmentID { get { - if (!this.Properties.TryGetValue("adjustment_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustment_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustment_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment_id"); } - set { this.Properties["adjustment_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +33,14 @@ public override void Validate() public RemoveAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemoveAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + RemoveAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemoveAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemoveAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemovePrice.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemovePrice.cs index c3d350ae..96dc17c0 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemovePrice.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/RemovePrice.cs @@ -1,13 +1,12 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemovePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemovePrice : ModelBase, IFromRaw { /// /// The external price id of the price to remove on the subscription. @@ -16,15 +15,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,12 +30,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -51,16 +47,14 @@ public override void Validate() public RemovePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemovePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + RemovePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemovePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemovePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustment.cs index eb73a5ae..3db4b6f8 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplaceAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplaceAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the subscription. @@ -18,17 +17,13 @@ public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw( - element - ) ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,25 +33,18 @@ public required string ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_adjustment_id"); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -69,16 +57,14 @@ public override void Validate() public ReplaceAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplaceAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplaceAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplaceAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplaceAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs index 4fa9bdb7..f7e4305d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplaceAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs index f24e2dda..3429d034 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ReplaceAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePrice.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePrice.cs index cad62c49..8a84763d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePrice.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplacePriceProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplacePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplacePrice : ModelBase, IFromRaw { /// /// The id of the price on the plan to replace in the subscription. @@ -20,55 +17,47 @@ public required string ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_price_id"); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_price_id"); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new allocation price to create and add to the subscription. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// /// [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the /// replacement price. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,15 +67,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -96,17 +82,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,12 +98,12 @@ public string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -133,27 +114,27 @@ public string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new price to create and add to the subscription. /// - public ReplacePriceProperties::Price? Price + public ReplacePriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -163,12 +144,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -190,16 +171,14 @@ public override void Validate() public ReplacePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplacePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplacePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplacePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplacePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/Price.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/Price.cs deleted file mode 100644 index 11ce3aec..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/Price.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Orb = Orb; -using PriceVariants = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; - -namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties; - -/// -/// The definition of a new price to create and add to the subscription. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewSubscriptionUnitPrice Create( - Subscriptions::NewSubscriptionUnitPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackagePrice Create( - Subscriptions::NewSubscriptionPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixPrice Create( - Subscriptions::NewSubscriptionMatrixPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPrice Create( - Subscriptions::NewSubscriptionTieredPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredBPSPrice Create( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBPSPrice Create( - Subscriptions::NewSubscriptionBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkBPSPrice Create( - Subscriptions::NewSubscriptionBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkPrice Create( - Subscriptions::NewSubscriptionBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionThresholdTotalAmountPrice Create( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackagePrice Create( - Subscriptions::NewSubscriptionTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithPercentPrice Create( - Subscriptions::NewSubscriptionUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackageWithAllocationPrice Create( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTierWithProrationPrice Create( - Subscriptions::NewSubscriptionTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithProrationPrice Create( - Subscriptions::NewSubscriptionUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedAllocationPrice Create( - Subscriptions::NewSubscriptionGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithProratedMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkWithProrationPrice Create( - Subscriptions::NewSubscriptionBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionCumulativeGroupedBulkPrice Create( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMaxGroupTieredPackagePrice Create( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithDisplayNamePrice Create( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPackagePrice Create( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithAllocationPrice Create( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackageWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPrice Create( - Subscriptions::NewSubscriptionGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/Price1.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/Price1.cs new file mode 100644 index 00000000..dc56e841 --- /dev/null +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/Price1.cs @@ -0,0 +1,101 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties.PriceVariants; + +namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties; + +/// +/// The definition of a new price to create and add to the subscription. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewSubscriptionUnitPrice value) => + new PriceVariants::NewSubscriptionUnitPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackagePrice value) => + new PriceVariants::NewSubscriptionPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixPrice value) => + new PriceVariants::NewSubscriptionMatrixPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPrice value) => + new PriceVariants::NewSubscriptionTieredPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredBPSPrice value) => + new PriceVariants::NewSubscriptionTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBPSPrice value) => + new PriceVariants::NewSubscriptionBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkBPSPrice value) => + new PriceVariants::NewSubscriptionBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkPrice value) => + new PriceVariants::NewSubscriptionBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionThresholdTotalAmountPrice value) => + new PriceVariants::NewSubscriptionThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackagePrice value) => + new PriceVariants::NewSubscriptionTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithPercentPrice value) => + new PriceVariants::NewSubscriptionUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackageWithAllocationPrice value) => + new PriceVariants::NewSubscriptionPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTierWithProrationPrice value) => + new PriceVariants::NewSubscriptionTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithProrationPrice value) => + new PriceVariants::NewSubscriptionUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedAllocationPrice value) => + new PriceVariants::NewSubscriptionGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkWithProrationPrice value) => + new PriceVariants::NewSubscriptionBulkWithProrationPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithUnitPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithTieredPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionCumulativeGroupedBulkPrice value) => + new PriceVariants::NewSubscriptionCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMaxGroupTieredPackagePrice value) => + new PriceVariants::NewSubscriptionMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithDisplayNamePrice value) => + new PriceVariants::NewSubscriptionMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPackagePrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithAllocationPrice value) => + new PriceVariants::NewSubscriptionMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackageWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/PriceVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/PriceVariants/All.cs index 68eb3614..6be769e6 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionCreateParamsProperties/ReplacePriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Orb = Orb; -using ReplacePriceProperties = Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionUnitPrice(Subscriptions::NewSubscriptionUnitPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionUnitPriceVariant(NewSubscriptionUnitPrice Value) + : Price1, + IVariant { - public static NewSubscriptionUnitPrice From(Subscriptions::NewSubscriptionUnitPrice value) + public static NewSubscriptionUnitPriceVariant From(NewSubscriptionUnitPrice value) { return new(value); } @@ -23,19 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackagePrice, - Subscriptions::NewSubscriptionPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionPackagePrice( - Subscriptions::NewSubscriptionPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionPackagePriceVariant(NewSubscriptionPackagePrice Value) + : Price1, + IVariant { - public static NewSubscriptionPackagePrice From(Subscriptions::NewSubscriptionPackagePrice value) + public static NewSubscriptionPackagePriceVariant From(NewSubscriptionPackagePrice value) { return new(value); } @@ -46,19 +36,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixPrice, - Subscriptions::NewSubscriptionMatrixPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionMatrixPrice( - Subscriptions::NewSubscriptionMatrixPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionMatrixPriceVariant(NewSubscriptionMatrixPrice Value) + : Price1, + IVariant { - public static NewSubscriptionMatrixPrice From(Subscriptions::NewSubscriptionMatrixPrice value) + public static NewSubscriptionMatrixPriceVariant From(NewSubscriptionMatrixPrice value) { return new(value); } @@ -69,19 +54,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPrice, - Subscriptions::NewSubscriptionTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredPrice( - Subscriptions::NewSubscriptionTieredPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredPriceVariant(NewSubscriptionTieredPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredPrice From(Subscriptions::NewSubscriptionTieredPrice value) + public static NewSubscriptionTieredPriceVariant From(NewSubscriptionTieredPrice value) { return new(value); } @@ -92,21 +72,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredBPSPrice, - Subscriptions::NewSubscriptionTieredBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredBPSPrice( - Subscriptions::NewSubscriptionTieredBPSPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredBPSPriceVariant(NewSubscriptionTieredBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredBPSPrice From( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) + public static NewSubscriptionTieredBPSPriceVariant From(NewSubscriptionTieredBPSPrice value) { return new(value); } @@ -117,14 +90,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBPSPrice(Subscriptions::NewSubscriptionBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBPSPriceVariant(NewSubscriptionBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBPSPrice From(Subscriptions::NewSubscriptionBPSPrice value) + public static NewSubscriptionBPSPriceVariant From(NewSubscriptionBPSPrice value) { return new(value); } @@ -135,19 +106,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkBPSPrice, - Subscriptions::NewSubscriptionBulkBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionBulkBPSPrice( - Subscriptions::NewSubscriptionBulkBPSPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionBulkBPSPriceVariant(NewSubscriptionBulkBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkBPSPrice From(Subscriptions::NewSubscriptionBulkBPSPrice value) + public static NewSubscriptionBulkBPSPriceVariant From(NewSubscriptionBulkBPSPrice value) { return new(value); } @@ -158,14 +124,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBulkPrice(Subscriptions::NewSubscriptionBulkPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBulkPriceVariant(NewSubscriptionBulkPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkPrice From(Subscriptions::NewSubscriptionBulkPrice value) + public static NewSubscriptionBulkPriceVariant From(NewSubscriptionBulkPrice value) { return new(value); } @@ -176,23 +140,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice >) )] -public sealed record class NewSubscriptionThresholdTotalAmountPrice( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice Value +public sealed record class NewSubscriptionThresholdTotalAmountPriceVariant( + NewSubscriptionThresholdTotalAmountPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice + : Price1, + IVariant< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice > { - public static NewSubscriptionThresholdTotalAmountPrice From( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value + public static NewSubscriptionThresholdTotalAmountPriceVariant From( + NewSubscriptionThresholdTotalAmountPrice value ) { return new(value); @@ -204,23 +168,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackagePriceVariant, + NewSubscriptionTieredPackagePrice >) )] -public sealed record class NewSubscriptionTieredPackagePrice( - Subscriptions::NewSubscriptionTieredPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice - > +public sealed record class NewSubscriptionTieredPackagePriceVariant( + NewSubscriptionTieredPackagePrice Value +) : Price1, IVariant { - public static NewSubscriptionTieredPackagePrice From( - Subscriptions::NewSubscriptionTieredPackagePrice value + public static NewSubscriptionTieredPackagePriceVariant From( + NewSubscriptionTieredPackagePrice value ) { return new(value); @@ -232,23 +191,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredWithMinimumPrice( - Subscriptions::NewSubscriptionTieredWithMinimumPrice Value +public sealed record class NewSubscriptionTieredWithMinimumPriceVariant( + NewSubscriptionTieredWithMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice > { - public static NewSubscriptionTieredWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value + public static NewSubscriptionTieredWithMinimumPriceVariant From( + NewSubscriptionTieredWithMinimumPrice value ) { return new(value); @@ -260,23 +219,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithPercentPriceVariant, + NewSubscriptionUnitWithPercentPrice >) )] -public sealed record class NewSubscriptionUnitWithPercentPrice( - Subscriptions::NewSubscriptionUnitWithPercentPrice Value +public sealed record class NewSubscriptionUnitWithPercentPriceVariant( + NewSubscriptionUnitWithPercentPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice - > + : Price1, + IVariant { - public static NewSubscriptionUnitWithPercentPrice From( - Subscriptions::NewSubscriptionUnitWithPercentPrice value + public static NewSubscriptionUnitWithPercentPriceVariant From( + NewSubscriptionUnitWithPercentPrice value ) { return new(value); @@ -288,23 +244,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice >) )] -public sealed record class NewSubscriptionPackageWithAllocationPrice( - Subscriptions::NewSubscriptionPackageWithAllocationPrice Value +public sealed record class NewSubscriptionPackageWithAllocationPriceVariant( + NewSubscriptionPackageWithAllocationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice > { - public static NewSubscriptionPackageWithAllocationPrice From( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value + public static NewSubscriptionPackageWithAllocationPriceVariant From( + NewSubscriptionPackageWithAllocationPrice value ) { return new(value); @@ -316,23 +272,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice >) )] -public sealed record class NewSubscriptionTierWithProrationPrice( - Subscriptions::NewSubscriptionTierWithProrationPrice Value +public sealed record class NewSubscriptionTierWithProrationPriceVariant( + NewSubscriptionTierWithProrationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice + : Price1, + IVariant< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice > { - public static NewSubscriptionTierWithProrationPrice From( - Subscriptions::NewSubscriptionTierWithProrationPrice value + public static NewSubscriptionTierWithProrationPriceVariant From( + NewSubscriptionTierWithProrationPrice value ) { return new(value); @@ -344,23 +300,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice >) )] -public sealed record class NewSubscriptionUnitWithProrationPrice( - Subscriptions::NewSubscriptionUnitWithProrationPrice Value +public sealed record class NewSubscriptionUnitWithProrationPriceVariant( + NewSubscriptionUnitWithProrationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice + : Price1, + IVariant< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice > { - public static NewSubscriptionUnitWithProrationPrice From( - Subscriptions::NewSubscriptionUnitWithProrationPrice value + public static NewSubscriptionUnitWithProrationPriceVariant From( + NewSubscriptionUnitWithProrationPrice value ) { return new(value); @@ -372,23 +328,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice >) )] -public sealed record class NewSubscriptionGroupedAllocationPrice( - Subscriptions::NewSubscriptionGroupedAllocationPrice Value +public sealed record class NewSubscriptionGroupedAllocationPriceVariant( + NewSubscriptionGroupedAllocationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice + : Price1, + IVariant< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice > { - public static NewSubscriptionGroupedAllocationPrice From( - Subscriptions::NewSubscriptionGroupedAllocationPrice value + public static NewSubscriptionGroupedAllocationPriceVariant From( + NewSubscriptionGroupedAllocationPrice value ) { return new(value); @@ -400,23 +356,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithProratedMinimumPriceVariant( + NewSubscriptionGroupedWithProratedMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice > { - public static NewSubscriptionGroupedWithProratedMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value + public static NewSubscriptionGroupedWithProratedMinimumPriceVariant From( + NewSubscriptionGroupedWithProratedMinimumPrice value ) { return new(value); @@ -428,23 +384,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice >) )] -public sealed record class NewSubscriptionBulkWithProrationPrice( - Subscriptions::NewSubscriptionBulkWithProrationPrice Value +public sealed record class NewSubscriptionBulkWithProrationPriceVariant( + NewSubscriptionBulkWithProrationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice + : Price1, + IVariant< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice > { - public static NewSubscriptionBulkWithProrationPrice From( - Subscriptions::NewSubscriptionBulkWithProrationPrice value + public static NewSubscriptionBulkWithProrationPriceVariant From( + NewSubscriptionBulkWithProrationPrice value ) { return new(value); @@ -456,23 +412,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPriceVariant( + NewSubscriptionScalableMatrixWithUnitPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice > { - public static NewSubscriptionScalableMatrixWithUnitPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value + public static NewSubscriptionScalableMatrixWithUnitPricingPriceVariant From( + NewSubscriptionScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -484,23 +440,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPriceVariant( + NewSubscriptionScalableMatrixWithTieredPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice > { - public static NewSubscriptionScalableMatrixWithTieredPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value + public static NewSubscriptionScalableMatrixWithTieredPricingPriceVariant From( + NewSubscriptionScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -512,23 +468,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice >) )] -public sealed record class NewSubscriptionCumulativeGroupedBulkPrice( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice Value +public sealed record class NewSubscriptionCumulativeGroupedBulkPriceVariant( + NewSubscriptionCumulativeGroupedBulkPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice > { - public static NewSubscriptionCumulativeGroupedBulkPrice From( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value + public static NewSubscriptionCumulativeGroupedBulkPriceVariant From( + NewSubscriptionCumulativeGroupedBulkPrice value ) { return new(value); @@ -540,23 +496,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice >) )] -public sealed record class NewSubscriptionMaxGroupTieredPackagePrice( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice Value +public sealed record class NewSubscriptionMaxGroupTieredPackagePriceVariant( + NewSubscriptionMaxGroupTieredPackagePrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice > { - public static NewSubscriptionMaxGroupTieredPackagePrice From( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value + public static NewSubscriptionMaxGroupTieredPackagePriceVariant From( + NewSubscriptionMaxGroupTieredPackagePrice value ) { return new(value); @@ -568,23 +524,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithMeteredMinimumPriceVariant( + NewSubscriptionGroupedWithMeteredMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice > { - public static NewSubscriptionGroupedWithMeteredMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value + public static NewSubscriptionGroupedWithMeteredMinimumPriceVariant From( + NewSubscriptionGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -596,23 +552,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice >) )] -public sealed record class NewSubscriptionMatrixWithDisplayNamePrice( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice Value +public sealed record class NewSubscriptionMatrixWithDisplayNamePriceVariant( + NewSubscriptionMatrixWithDisplayNamePrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice > { - public static NewSubscriptionMatrixWithDisplayNamePrice From( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value + public static NewSubscriptionMatrixWithDisplayNamePriceVariant From( + NewSubscriptionMatrixWithDisplayNamePrice value ) { return new(value); @@ -624,23 +580,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice >) )] -public sealed record class NewSubscriptionGroupedTieredPackagePrice( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice Value +public sealed record class NewSubscriptionGroupedTieredPackagePriceVariant( + NewSubscriptionGroupedTieredPackagePrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice > { - public static NewSubscriptionGroupedTieredPackagePrice From( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value + public static NewSubscriptionGroupedTieredPackagePriceVariant From( + NewSubscriptionGroupedTieredPackagePrice value ) { return new(value); @@ -652,23 +608,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice >) )] -public sealed record class NewSubscriptionMatrixWithAllocationPrice( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice Value +public sealed record class NewSubscriptionMatrixWithAllocationPriceVariant( + NewSubscriptionMatrixWithAllocationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice > { - public static NewSubscriptionMatrixWithAllocationPrice From( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value + public static NewSubscriptionMatrixWithAllocationPriceVariant From( + NewSubscriptionMatrixWithAllocationPrice value ) { return new(value); @@ -680,23 +636,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredPackageWithMinimumPrice( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice Value +public sealed record class NewSubscriptionTieredPackageWithMinimumPriceVariant( + NewSubscriptionTieredPackageWithMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice > { - public static NewSubscriptionTieredPackageWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value + public static NewSubscriptionTieredPackageWithMinimumPriceVariant From( + NewSubscriptionTieredPackageWithMinimumPrice value ) { return new(value); @@ -708,23 +664,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPriceVariant, + NewSubscriptionGroupedTieredPrice >) )] -public sealed record class NewSubscriptionGroupedTieredPrice( - Subscriptions::NewSubscriptionGroupedTieredPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice - > +public sealed record class NewSubscriptionGroupedTieredPriceVariant( + NewSubscriptionGroupedTieredPrice Value +) : Price1, IVariant { - public static NewSubscriptionGroupedTieredPrice From( - Subscriptions::NewSubscriptionGroupedTieredPrice value + public static NewSubscriptionGroupedTieredPriceVariant From( + NewSubscriptionGroupedTieredPrice value ) { return new(value); diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParams.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParams.cs index 0b975710..31ec9c24 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using SubscriptionFetchCostsParamsProperties = Orb.Models.Subscriptions.SubscriptionFetchCostsParamsProperties; using System = System; @@ -17,7 +16,7 @@ namespace Orb.Models.Subscriptions; /// to a specific subscription for the customer (e.g. to de-aggregate costs when a /// customer's subscription has started and stopped on the same day). /// -public sealed record class SubscriptionFetchCostsParams : Orb::ParamsBase +public sealed record class SubscriptionFetchCostsParams : ParamsBase { public required string SubscriptionID; @@ -28,12 +27,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("currency", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("currency", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["currency"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["currency"] = JsonSerializer.SerializeToElement(value); } } /// @@ -43,15 +42,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_end", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,17 +57,12 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_start", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -83,17 +74,17 @@ public string? Currency { get { - if (!this.QueryProperties.TryGetValue("view_mode", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("view_mode", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set { this.QueryProperties["view_mode"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["view_mode"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -104,12 +95,12 @@ public string? Currency }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParamsProperties/ViewMode.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParamsProperties/ViewMode.cs index 22309700..ff0061de 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParamsProperties/ViewMode.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchCostsParamsProperties/ViewMode.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionFetchCostsParamsProperties; @@ -9,8 +8,8 @@ namespace Orb.Models.Subscriptions.SubscriptionFetchCostsParamsProperties; /// or incremental day-by-day costs. If your customer has minimums or discounts, it's /// strongly recommended that you use the default cumulative behavior. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ViewMode(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ViewMode(string value) : IEnum { public static readonly ViewMode Periodic = new("periodic"); @@ -29,7 +28,7 @@ public Value Known() => { "periodic" => Value.Periodic, "cumulative" => Value.Cumulative, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchCostsResponse.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchCostsResponse.cs index a139b9d9..64f8e450 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchCostsResponse.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchCostsResponse.cs @@ -1,29 +1,27 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class SubscriptionFetchCostsResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,15 +35,15 @@ public override void Validate() public SubscriptionFetchCostsResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionFetchCostsResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionFetchCostsResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubscriptionFetchCostsResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchParams.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchParams.cs index b308870a..e716fadf 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Subscriptions; @@ -8,11 +7,11 @@ namespace Orb.Models.Subscriptions; /// This endpoint is used to fetch a [Subscription](/core-concepts##subscription) /// given an identifier. /// -public sealed record class SubscriptionFetchParams : Orb::ParamsBase +public sealed record class SubscriptionFetchParams : ParamsBase { public required string SubscriptionID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -23,12 +22,12 @@ public sealed record class SubscriptionFetchParams : Orb::ParamsBase }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponse.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponse.cs index d48e0cc9..9bcc36c6 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponse.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponse.cs @@ -1,50 +1,46 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using SubscriptionFetchSchedulePageResponseProperties = Orb.Models.Subscriptions.SubscriptionFetchSchedulePageResponseProperties; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class SubscriptionFetchSchedulePageResponse - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( - element - ) ?? throw new System::ArgumentNullException("data"); + return JsonSerializer.Deserialize< + List + >(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -59,15 +55,15 @@ public override void Validate() public SubscriptionFetchSchedulePageResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - SubscriptionFetchSchedulePageResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + SubscriptionFetchSchedulePageResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static SubscriptionFetchSchedulePageResponse FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/Data.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/Data.cs index c71ff26f..a2e7bd68 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/Data.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/Data.cs @@ -1,71 +1,61 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Subscriptions.SubscriptionFetchSchedulePageResponseProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionFetchSchedulePageResponseProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { - public required System::DateTime CreatedAt + public required DateTime CreatedAt { get { - if (!this.Properties.TryGetValue("created_at", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "created_at", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("created_at", out JsonElement element)) + throw new ArgumentOutOfRangeException("created_at", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["created_at"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime? EndDate + public required DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "end_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("end_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::Plan? Plan { get { - if (!this.Properties.TryGetValue("plan", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("plan", "Missing required argument"); + if (!this.Properties.TryGetValue("plan", out JsonElement element)) + throw new ArgumentOutOfRangeException("plan", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["plan"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["plan"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime StartDate + public required DateTime StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "start_date", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) + throw new ArgumentOutOfRangeException("start_date", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -79,14 +69,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/DataProperties/Plan.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/DataProperties/Plan.cs index 1090ab9d..d1b7432a 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/DataProperties/Plan.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchSchedulePageResponseProperties/DataProperties/Plan.cs @@ -1,25 +1,24 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionFetchSchedulePageResponseProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Plan : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Plan : ModelBase, IFromRaw { public required string? ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -31,30 +30,27 @@ public required string? ExternalPlanID { get { - if (!this.Properties.TryGetValue("external_plan_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("external_plan_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "external_plan_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_plan_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } public required string? Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -67,14 +63,14 @@ public override void Validate() public Plan() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Plan(Generic::Dictionary properties) + [SetsRequiredMembers] + Plan(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Plan FromRawUnchecked(Generic::Dictionary properties) + public static Plan FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchScheduleParams.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchScheduleParams.cs index 8be0c2df..c8fb9720 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchScheduleParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchScheduleParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using System = System; namespace Orb.Models.Subscriptions; @@ -10,7 +9,7 @@ namespace Orb.Models.Subscriptions; /// associated with a subscription along with their start and end dates. This list /// contains the subscription's initial plan along with past and future plan changes. /// -public sealed record class SubscriptionFetchScheduleParams : Orb::ParamsBase +public sealed record class SubscriptionFetchScheduleParams : ParamsBase { public required string SubscriptionID; @@ -22,12 +21,12 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,79 +36,63 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? StartDateGt { get { - if (!this.QueryProperties.TryGetValue("start_date[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("start_date[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["start_date[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["start_date[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? StartDateGte { get { - if (!this.QueryProperties.TryGetValue("start_date[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("start_date[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["start_date[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["start_date[gte]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? StartDateLt { get { - if (!this.QueryProperties.TryGetValue("start_date[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("start_date[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["start_date[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["start_date[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? StartDateLte { get { - if (!this.QueryProperties.TryGetValue("start_date[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("start_date[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["start_date[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["start_date[lte]"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -120,12 +103,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParams.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParams.cs index df201a44..f99c3ee1 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Net.Http; +using System.Text.Json; using SubscriptionFetchUsageParamsProperties = Orb.Models.Subscriptions.SubscriptionFetchUsageParamsProperties; using System = System; @@ -134,7 +133,7 @@ namespace Orb.Models.Subscriptions; /// - `first_dimension_key`: `region` - `first_dimension_value`: `us-east-1` - `second_dimension_key`: /// `provider` - `second_dimension_value`: `aws` /// -public sealed record class SubscriptionFetchUsageParams : Orb::ParamsBase +public sealed record class SubscriptionFetchUsageParams : ParamsBase { public required string SubscriptionID; @@ -147,21 +146,14 @@ public string? BillableMetricID { get { - if ( - !this.QueryProperties.TryGetValue( - "billable_metric_id", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("billable_metric_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["billable_metric_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["billable_metric_id"] = JsonSerializer.SerializeToElement(value); } } @@ -169,21 +161,14 @@ public string? FirstDimensionKey { get { - if ( - !this.QueryProperties.TryGetValue( - "first_dimension_key", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("first_dimension_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["first_dimension_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["first_dimension_key"] = JsonSerializer.SerializeToElement(value); } } @@ -191,19 +176,14 @@ public string? FirstDimensionValue { get { - if ( - !this.QueryProperties.TryGetValue( - "first_dimension_value", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("first_dimension_value", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["first_dimension_value"] = Json::JsonSerializer.SerializeToElement( + this.QueryProperties["first_dimension_value"] = JsonSerializer.SerializeToElement( value ); } @@ -216,17 +196,14 @@ public string? FirstDimensionValue { get { - if (!this.QueryProperties.TryGetValue("granularity", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("granularity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.QueryProperties["granularity"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.QueryProperties["granularity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -236,33 +213,26 @@ public string? GroupBy { get { - if (!this.QueryProperties.TryGetValue("group_by", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("group_by", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["group_by"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["group_by"] = JsonSerializer.SerializeToElement(value); } } public string? SecondDimensionKey { get { - if ( - !this.QueryProperties.TryGetValue( - "second_dimension_key", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("second_dimension_key", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["second_dimension_key"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["second_dimension_key"] = JsonSerializer.SerializeToElement(value); } } @@ -271,19 +241,17 @@ public string? SecondDimensionValue get { if ( - !this.QueryProperties.TryGetValue( - "second_dimension_value", - out Json::JsonElement element - ) + !this.QueryProperties.TryGetValue("second_dimension_value", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.QueryProperties["second_dimension_value"] = - Json::JsonSerializer.SerializeToElement(value); + this.QueryProperties["second_dimension_value"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -294,15 +262,12 @@ public string? SecondDimensionValue { get { - if (!this.QueryProperties.TryGetValue("timeframe_end", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_end", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } /// @@ -312,17 +277,12 @@ public string? SecondDimensionValue { get { - if (!this.QueryProperties.TryGetValue("timeframe_start", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("timeframe_start", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["timeframe_start"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } /// @@ -334,17 +294,17 @@ public string? SecondDimensionValue { get { - if (!this.QueryProperties.TryGetValue("view_mode", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("view_mode", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set { this.QueryProperties["view_mode"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["view_mode"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -355,12 +315,12 @@ public string? SecondDimensionValue }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/Granularity.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/Granularity.cs index 851e46c2..7b15dd2f 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/Granularity.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/Granularity.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionFetchUsageParamsProperties; /// /// This determines the windowing of usage reporting. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Granularity(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Granularity(string value) : IEnum { public static readonly Granularity Day = new("day"); @@ -23,7 +22,7 @@ public Value Known() => _value switch { "day" => Value.Day, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/ViewMode.cs b/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/ViewMode.cs index bfd7833a..71ffe7b5 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/ViewMode.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionFetchUsageParamsProperties/ViewMode.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionFetchUsageParamsProperties; @@ -9,8 +8,8 @@ namespace Orb.Models.Subscriptions.SubscriptionFetchUsageParamsProperties; /// or incremental day-by-day usage. If your customer has minimums or discounts, it's /// strongly recommended that you use the default cumulative behavior. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ViewMode(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ViewMode(string value) : IEnum { public static readonly ViewMode Periodic = new("periodic"); @@ -29,7 +28,7 @@ public Value Known() => { "periodic" => Value.Periodic, "cumulative" => Value.Cumulative, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionListParams.cs b/src/Orb/Models/Subscriptions/SubscriptionListParams.cs index b14b7bc5..43e01709 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionListParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionListParams.cs @@ -1,7 +1,6 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text.Json; using SubscriptionListParamsProperties = Orb.Models.Subscriptions.SubscriptionListParamsProperties; using System = System; @@ -16,70 +15,54 @@ namespace Orb.Models.Subscriptions; /// or external_customer_id query parameters. To filter subscriptions for multiple /// customers, use the customer_id[] or external_customer_id[] query parameters. /// -public sealed record class SubscriptionListParams : Orb::ParamsBase +public sealed record class SubscriptionListParams : ParamsBase { public System::DateTime? CreatedAtGt { get { - if (!this.QueryProperties.TryGetValue("created_at[gt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtGte { get { - if (!this.QueryProperties.TryGetValue("created_at[gte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[gte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[gte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[gte]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLt { get { - if (!this.QueryProperties.TryGetValue("created_at[lt]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lt]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lt]"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lt]"] = JsonSerializer.SerializeToElement(value); } } public System::DateTime? CreatedAtLte { get { - if (!this.QueryProperties.TryGetValue("created_at[lte]", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("created_at[lte]", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.QueryProperties["created_at[lte]"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.QueryProperties["created_at[lte]"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,48 +73,38 @@ public string? Cursor { get { - if (!this.QueryProperties.TryGetValue("cursor", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("cursor", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["cursor"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["cursor"] = JsonSerializer.SerializeToElement(value); } } - public Generic::List? CustomerID + public List? CustomerID { get { - if (!this.QueryProperties.TryGetValue("customer_id", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.QueryProperties["customer_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.QueryProperties["customer_id"] = JsonSerializer.SerializeToElement(value); } } - public Generic::List? ExternalCustomerID + public List? ExternalCustomerID { get { - if ( - !this.QueryProperties.TryGetValue( - "external_customer_id", - out Json::JsonElement element - ) - ) + if (!this.QueryProperties.TryGetValue("external_customer_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } set { - this.QueryProperties["external_customer_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.QueryProperties["external_customer_id"] = JsonSerializer.SerializeToElement(value); } } @@ -142,29 +115,27 @@ public long? Limit { get { - if (!this.QueryProperties.TryGetValue("limit", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("limit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["limit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["limit"] = JsonSerializer.SerializeToElement(value); } } public SubscriptionListParamsProperties::Status? Status { get { - if (!this.QueryProperties.TryGetValue("status", out Json::JsonElement element)) + if (!this.QueryProperties.TryGetValue("status", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } - set { this.QueryProperties["status"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.QueryProperties["status"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/subscriptions") { @@ -172,12 +143,12 @@ public long? Limit }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionListParamsProperties/Status.cs b/src/Orb/Models/Subscriptions/SubscriptionListParamsProperties/Status.cs index a9682818..5dde6789 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionListParamsProperties/Status.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionListParamsProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionListParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -28,7 +27,7 @@ public Value Known() => "active" => Value.Active, "ended" => Value.Ended, "upcoming" => Value.Upcoming, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParams.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParams.cs index e2cac143..d497c016 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using SubscriptionPriceIntervalsParamsProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -77,47 +76,44 @@ namespace Orb.Models.Subscriptions; /// of transitions can be retrieved using the `fixed_fee_quantity_transitions` property /// on a subscription’s serialized price intervals. /// -public sealed record class SubscriptionPriceIntervalsParams : Orb::ParamsBase +public sealed record class SubscriptionPriceIntervalsParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; /// /// A list of price intervals to add to the subscription. /// - public Generic::List? Add + public List? Add { get { - if (!this.BodyProperties.TryGetValue("add", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["add"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["add"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of adjustments to add to the subscription. /// - public Generic::List? AddAdjustments + public List? AddAdjustments { get { - if (!this.BodyProperties.TryGetValue("add_adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["add_adjustments"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["add_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// @@ -132,60 +128,56 @@ public bool? AllowInvoiceCreditOrVoid if ( !this.BodyProperties.TryGetValue( "allow_invoice_credit_or_void", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["allow_invoice_credit_or_void"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["allow_invoice_credit_or_void"] = JsonSerializer.SerializeToElement( + value + ); } } /// /// A list of price intervals to edit on the subscription. /// - public Generic::List? Edit + public List? Edit { get { - if (!this.BodyProperties.TryGetValue("edit", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("edit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["edit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["edit"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of adjustments to edit on the subscription. /// - public Generic::List? EditAdjustments + public List? EditAdjustments { get { - if (!this.BodyProperties.TryGetValue("edit_adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("edit_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["edit_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.BodyProperties["edit_adjustments"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -196,21 +188,21 @@ public bool? AllowInvoiceCreditOrVoid }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Add.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Add.cs index 9bfeffe4..e536978c 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Add.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Add.cs @@ -1,16 +1,14 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Add : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Add : ModelBase, IFromRaw { /// /// The start date of the price interval. This is the date that the price will @@ -20,51 +18,46 @@ public sealed record class Add : Orb::ModelBase, Orb::IFromRaw { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("start_date"); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new allocation price to create and add to the subscription. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of discounts to initialize on the price interval. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -75,12 +68,12 @@ public sealed record class Add : Orb::ModelBase, Orb::IFromRaw { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,15 +83,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -110,37 +100,38 @@ public string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// /// A list of fixed fee quantity transitions to initialize on the price interval. /// - public Generic::List? FixedFeeQuantityTransitions + public List? FixedFeeQuantityTransitions { get { if ( !this.Properties.TryGetValue( "fixed_fee_quantity_transitions", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.Properties["fixed_fee_quantity_transitions"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["fixed_fee_quantity_transitions"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -151,12 +142,12 @@ public double? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -166,27 +157,27 @@ public double? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new price to create and add to the subscription. /// - public AddProperties::Price? Price + public AddProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -196,12 +187,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -212,19 +203,16 @@ public string? PriceID /// usage_customer_ids must be either the customer for this subscription itself, /// or any of that customer's children. /// - public Generic::List? UsageCustomerIDs + public List? UsageCustomerIDs { get { - if (!this.Properties.TryGetValue("usage_customer_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_customer_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -255,14 +243,14 @@ public override void Validate() public Add() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Add(Generic::Dictionary properties) + [SetsRequiredMembers] + Add(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Add FromRawUnchecked(Generic::Dictionary properties) + public static Add FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustment.cs index 80d25e11..aae67514 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustment.cs @@ -1,15 +1,14 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the subscription. @@ -18,16 +17,16 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -40,16 +39,16 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("start_date"); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -62,12 +61,12 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -80,16 +79,14 @@ public override void Validate() public AddAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + AddAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/Adjustment.cs index b2bdd274..644c85df 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs index 8b1fe470..dd8dfd82 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDate.cs index 7c401c1e..12b0b1a1 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDate.cs @@ -1,7 +1,5 @@ +using System.Text.Json.Serialization; using EndDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties.EndDateVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; @@ -12,16 +10,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ad /// dates that overlap with this `end_date`.This `end_date` is treated as exclusive /// for in-advance prices, and inclusive for in-arrears prices. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class EndDate { internal EndDate() { } - public static EndDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator EndDate(System::DateTime value) => + new EndDateVariants::DateTime(value); - public static EndDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator EndDate(BillingCycleRelativeDate value) => + new EndDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDateVariants/All.cs index 183de5ad..c160be66 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/EndDateVariants/All.cs @@ -1,15 +1,12 @@ -using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties.EndDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : AddAdjustmentProperties::EndDate, - Orb::IVariant + : EndDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : AddAdjustmentProperties::EndDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : EndDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDate.cs index cee0595c..18d83fdd 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDate.cs @@ -1,6 +1,4 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using StartDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties.StartDateVariants; using System = System; @@ -12,16 +10,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ad /// invoice dates that overlap with this `start_date`. This `start_date` is treated /// as inclusive for in-advance prices, and exclusive for in-arrears prices. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class StartDate { internal StartDate() { } - public static StartDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator StartDate(System::DateTime value) => + new StartDateVariants::DateTime(value); - public static StartDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator StartDate(BillingCycleRelativeDate value) => + new StartDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDateVariants/All.cs index 017d629e..3c9416a4 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddAdjustmentProperties/StartDateVariants/All.cs @@ -1,15 +1,12 @@ -using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddAdjustmentProperties.StartDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : AddAdjustmentProperties::StartDate, - Orb::IVariant + : StartDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : AddAdjustmentProperties::StartDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : StartDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Discount.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Discount.cs index 011e56fb..aa9ef55b 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Discount.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Discount.cs @@ -1,21 +1,22 @@ +using System.Text.Json.Serialization; using DiscountProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; using DiscountVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountVariants; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Discount { internal Discount() { } - public static DiscountVariants::Amount Create(DiscountProperties::Amount value) => new(value); + public static implicit operator Discount(DiscountProperties::Amount value) => + new DiscountVariants::Amount(value); - public static DiscountVariants::Percentage Create(DiscountProperties::Percentage value) => - new(value); + public static implicit operator Discount(DiscountProperties::Percentage value) => + new DiscountVariants::Percentage(value); - public static DiscountVariants::Usage Create(DiscountProperties::Usage value) => new(value); + public static implicit operator Discount(DiscountProperties::Usage value) => + new DiscountVariants::Usage(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Amount.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Amount.cs index 6e3d705b..4a920eb5 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Amount.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Amount.cs @@ -1,15 +1,13 @@ -using AmountProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.AmountProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Amount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Amount : ModelBase, IFromRaw { /// /// Only available if discount_type is `amount`. @@ -18,50 +16,48 @@ public required double AmountDiscount { get { - if (!this.Properties.TryGetValue("amount_discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("amount_discount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "amount_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["amount_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount_discount"] = JsonSerializer.SerializeToElement(value); } } - public required AmountProperties::DiscountType DiscountType + public JsonElement DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { _ = this.AmountDiscount; - this.DiscountType.Validate(); } - public Amount() { } + public Amount() + { + this.DiscountType = JsonSerializer.Deserialize("\"amount\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Amount(Generic::Dictionary properties) + [SetsRequiredMembers] + Amount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Amount FromRawUnchecked(Generic::Dictionary properties) + public static Amount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/AmountProperties/DiscountType.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/AmountProperties/DiscountType.cs deleted file mode 100644 index 4ac283b6..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/AmountProperties/DiscountType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.AmountProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum -{ - public static readonly DiscountType Amount = new("amount"); - - readonly string _value = value; - - public enum Value - { - Amount, - } - - public Value Known() => - _value switch - { - "amount" => Value.Amount, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static DiscountType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Percentage.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Percentage.cs index dd773e58..e3eff636 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Percentage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Percentage.cs @@ -1,30 +1,24 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using PercentageProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.PercentageProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Percentage : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Percentage : ModelBase, IFromRaw { - public required PercentageProperties::DiscountType DiscountType + public JsonElement DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,39 +29,36 @@ public required double PercentageDiscount { get { - if (!this.Properties.TryGetValue("percentage_discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("percentage_discount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "percentage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["percentage_discount"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["percentage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { - this.DiscountType.Validate(); _ = this.PercentageDiscount; } - public Percentage() { } + public Percentage() + { + this.DiscountType = JsonSerializer.Deserialize("\"percentage\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Percentage(Generic::Dictionary properties) + [SetsRequiredMembers] + Percentage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Percentage FromRawUnchecked( - Generic::Dictionary properties - ) + public static Percentage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/PercentageProperties/DiscountType.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/PercentageProperties/DiscountType.cs deleted file mode 100644 index c6777abd..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/PercentageProperties/DiscountType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.PercentageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum -{ - public static readonly DiscountType Percentage = new("percentage"); - - readonly string _value = value; - - public enum Value - { - Percentage, - } - - public Value Known() => - _value switch - { - "percentage" => Value.Percentage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static DiscountType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Usage.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Usage.cs index 7ebf5aa6..9781a8c0 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Usage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/Usage.cs @@ -1,30 +1,24 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; -using UsageProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.UsageProperties; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Usage : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Usage : ModelBase, IFromRaw { - public required UsageProperties::DiscountType DiscountType + public JsonElement DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "discount_type", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) + throw new ArgumentOutOfRangeException("discount_type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("discount_type"); + return JsonSerializer.Deserialize(element); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,34 +29,36 @@ public required double UsageDiscount { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) + throw new ArgumentOutOfRangeException( "usage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() { - this.DiscountType.Validate(); _ = this.UsageDiscount; } - public Usage() { } + public Usage() + { + this.DiscountType = JsonSerializer.Deserialize("\"usage\""); + } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Usage(Generic::Dictionary properties) + [SetsRequiredMembers] + Usage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Usage FromRawUnchecked(Generic::Dictionary properties) + public static Usage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/UsageProperties/DiscountType.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/UsageProperties/DiscountType.cs deleted file mode 100644 index 1f37c4b1..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountProperties/UsageProperties/DiscountType.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; - -namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties.UsageProperties; - -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum -{ - public static readonly DiscountType Usage = new("usage"); - - readonly string _value = value; - - public enum Value - { - Usage, - } - - public Value Known() => - _value switch - { - "usage" => Value.Usage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), - }; - - public string Raw() - { - return _value; - } - - public void Validate() - { - Known(); - } - - public static DiscountType FromRaw(string value) - { - return new(value); - } -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountVariants/All.cs index c4d514d4..aad7359b 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/DiscountVariants/All.cs @@ -1,14 +1,12 @@ -using AddProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; +using System.Text.Json.Serialization; using DiscountProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.DiscountVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Amount(DiscountProperties::Amount Value) - : AddProperties::Discount, - Orb::IVariant + : Discount, + IVariant { public static Amount From(DiscountProperties::Amount value) { @@ -21,12 +19,10 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class Percentage(DiscountProperties::Percentage Value) - : AddProperties::Discount, - Orb::IVariant + : Discount, + IVariant { public static Percentage From(DiscountProperties::Percentage value) { @@ -39,10 +35,10 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class Usage(DiscountProperties::Usage Value) - : AddProperties::Discount, - Orb::IVariant + : Discount, + IVariant { public static Usage From(DiscountProperties::Usage value) { diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDate.cs index b69f5afa..57dfda2e 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDate.cs @@ -1,7 +1,5 @@ +using System.Text.Json.Serialization; using EndDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.EndDateVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; @@ -10,16 +8,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ad /// The end date of the price interval. This is the date that the price will stop /// billing on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class EndDate { internal EndDate() { } - public static EndDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator EndDate(System::DateTime value) => + new EndDateVariants::DateTime(value); - public static EndDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator EndDate(BillingCycleRelativeDate value) => + new EndDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDateVariants/All.cs index 465adf4a..9e8d07fb 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/EndDateVariants/All.cs @@ -1,15 +1,12 @@ -using AddProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.EndDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : AddProperties::EndDate, - Orb::IVariant + : EndDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : AddProperties::EndDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : EndDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/FixedFeeQuantityTransition.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/FixedFeeQuantityTransition1.cs similarity index 52% rename from src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/FixedFeeQuantityTransition.cs rename to src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/FixedFeeQuantityTransition1.cs index 0b6275ed..a267a677 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/FixedFeeQuantityTransition.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/FixedFeeQuantityTransition1.cs @@ -1,16 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class FixedFeeQuantityTransition - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class FixedFeeQuantityTransition1 + : ModelBase, + IFromRaw { /// /// The date that the fixed fee quantity transition should take effect. @@ -19,15 +18,15 @@ public sealed record class FixedFeeQuantityTransition { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "effective_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +36,15 @@ public required long Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,18 +53,18 @@ public override void Validate() _ = this.Quantity; } - public FixedFeeQuantityTransition() { } + public FixedFeeQuantityTransition1() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - FixedFeeQuantityTransition(Generic::Dictionary properties) + [SetsRequiredMembers] + FixedFeeQuantityTransition1(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static FixedFeeQuantityTransition FromRawUnchecked( - Generic::Dictionary properties + public static FixedFeeQuantityTransition1 FromRawUnchecked( + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Price.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Price.cs deleted file mode 100644 index 50ff632c..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Price.cs +++ /dev/null @@ -1,126 +0,0 @@ -using Models = Orb.Models; -using Orb = Orb; -using PriceVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; - -namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; - -/// -/// The definition of a new price to create and add to the subscription. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewFloatingUnitPrice Create(Models::NewFloatingUnitPrice value) => - new(value); - - public static PriceVariants::NewFloatingPackagePrice Create( - Models::NewFloatingPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixPrice Create( - Models::NewFloatingMatrixPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixWithAllocationPrice Create( - Models::NewFloatingMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPrice Create( - Models::NewFloatingTieredPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredBPSPrice Create( - Models::NewFloatingTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewFloatingBPSPrice Create(Models::NewFloatingBPSPrice value) => - new(value); - - public static PriceVariants::NewFloatingBulkBPSPrice Create( - Models::NewFloatingBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewFloatingBulkPrice Create(Models::NewFloatingBulkPrice value) => - new(value); - - public static PriceVariants::NewFloatingThresholdTotalAmountPrice Create( - Models::NewFloatingThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPackagePrice Create( - Models::NewFloatingTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedTieredPrice Create( - Models::NewFloatingGroupedTieredPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMaxGroupTieredPackagePrice Create( - Models::NewFloatingMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredWithMinimumPrice Create( - Models::NewFloatingTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingPackageWithAllocationPrice Create( - Models::NewFloatingPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredPackageWithMinimumPrice Create( - Models::NewFloatingTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingUnitWithPercentPrice Create( - Models::NewFloatingUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewFloatingTieredWithProrationPrice Create( - Models::NewFloatingTieredWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingUnitWithProrationPrice Create( - Models::NewFloatingUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedAllocationPrice Create( - Models::NewFloatingGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedWithProratedMinimumPrice Create( - Models::NewFloatingGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedWithMeteredMinimumPrice Create( - Models::NewFloatingGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewFloatingMatrixWithDisplayNamePrice Create( - Models::NewFloatingMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewFloatingBulkWithProrationPrice Create( - Models::NewFloatingBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewFloatingGroupedTieredPackagePrice Create( - Models::NewFloatingGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewFloatingScalableMatrixWithUnitPricingPrice Create( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewFloatingScalableMatrixWithTieredPricingPrice Create( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewFloatingCumulativeGroupedBulkPrice Create( - Models::NewFloatingCumulativeGroupedBulkPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Price1.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Price1.cs new file mode 100644 index 00000000..02447147 --- /dev/null +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/Price1.cs @@ -0,0 +1,99 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.PriceVariants; + +namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; + +/// +/// The definition of a new price to create and add to the subscription. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewFloatingUnitPrice value) => + new PriceVariants::NewFloatingUnitPriceVariant(value); + + public static implicit operator Price1(NewFloatingPackagePrice value) => + new PriceVariants::NewFloatingPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixPrice value) => + new PriceVariants::NewFloatingMatrixPriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixWithAllocationPrice value) => + new PriceVariants::NewFloatingMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPrice value) => + new PriceVariants::NewFloatingTieredPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredBPSPrice value) => + new PriceVariants::NewFloatingTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBPSPrice value) => + new PriceVariants::NewFloatingBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkBPSPrice value) => + new PriceVariants::NewFloatingBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkPrice value) => + new PriceVariants::NewFloatingBulkPriceVariant(value); + + public static implicit operator Price1(NewFloatingThresholdTotalAmountPrice value) => + new PriceVariants::NewFloatingThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPackagePrice value) => + new PriceVariants::NewFloatingTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedTieredPrice value) => + new PriceVariants::NewFloatingGroupedTieredPriceVariant(value); + + public static implicit operator Price1(NewFloatingMaxGroupTieredPackagePrice value) => + new PriceVariants::NewFloatingMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredWithMinimumPrice value) => + new PriceVariants::NewFloatingTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingPackageWithAllocationPrice value) => + new PriceVariants::NewFloatingPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredPackageWithMinimumPrice value) => + new PriceVariants::NewFloatingTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingUnitWithPercentPrice value) => + new PriceVariants::NewFloatingUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewFloatingTieredWithProrationPrice value) => + new PriceVariants::NewFloatingTieredWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingUnitWithProrationPrice value) => + new PriceVariants::NewFloatingUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedAllocationPrice value) => + new PriceVariants::NewFloatingGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewFloatingGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewFloatingGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewFloatingMatrixWithDisplayNamePrice value) => + new PriceVariants::NewFloatingMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewFloatingBulkWithProrationPrice value) => + new PriceVariants::NewFloatingBulkWithProrationPriceVariant(value); + + public static implicit operator Price1(NewFloatingGroupedTieredPackagePrice value) => + new PriceVariants::NewFloatingGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewFloatingScalableMatrixWithUnitPricingPrice value) => + new PriceVariants::NewFloatingScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1(NewFloatingScalableMatrixWithTieredPricingPrice value) => + new PriceVariants::NewFloatingScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewFloatingCumulativeGroupedBulkPrice value) => + new PriceVariants::NewFloatingCumulativeGroupedBulkPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/PriceVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/PriceVariants/All.cs index cca9a00a..0593818a 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using AddProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingUnitPrice(Models::NewFloatingUnitPrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingUnitPriceVariant(NewFloatingUnitPrice Value) + : Price1, + IVariant { - public static NewFloatingUnitPrice From(Models::NewFloatingUnitPrice value) + public static NewFloatingUnitPriceVariant From(NewFloatingUnitPrice value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingPackagePrice(Models::NewFloatingPackagePrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingPackagePriceVariant(NewFloatingPackagePrice Value) + : Price1, + IVariant { - public static NewFloatingPackagePrice From(Models::NewFloatingPackagePrice value) + public static NewFloatingPackagePriceVariant From(NewFloatingPackagePrice value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingMatrixPrice(Models::NewFloatingMatrixPrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingMatrixPriceVariant(NewFloatingMatrixPrice Value) + : Price1, + IVariant { - public static NewFloatingMatrixPrice From(Models::NewFloatingMatrixPrice value) + public static NewFloatingMatrixPriceVariant From(NewFloatingMatrixPrice value) { return new(value); } @@ -59,23 +50,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithAllocationPriceVariant, + NewFloatingMatrixWithAllocationPrice >) )] -public sealed record class NewFloatingMatrixWithAllocationPrice( - Models::NewFloatingMatrixWithAllocationPrice Value +public sealed record class NewFloatingMatrixWithAllocationPriceVariant( + NewFloatingMatrixWithAllocationPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingMatrixWithAllocationPrice, - Models::NewFloatingMatrixWithAllocationPrice - > + : Price1, + IVariant { - public static NewFloatingMatrixWithAllocationPrice From( - Models::NewFloatingMatrixWithAllocationPrice value + public static NewFloatingMatrixWithAllocationPriceVariant From( + NewFloatingMatrixWithAllocationPrice value ) { return new(value); @@ -87,14 +75,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingTieredPrice(Models::NewFloatingTieredPrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingTieredPriceVariant(NewFloatingTieredPrice Value) + : Price1, + IVariant { - public static NewFloatingTieredPrice From(Models::NewFloatingTieredPrice value) + public static NewFloatingTieredPriceVariant From(NewFloatingTieredPrice value) { return new(value); } @@ -105,14 +91,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredBPSPrice(Models::NewFloatingTieredBPSPrice Value) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredBPSPriceVariant(NewFloatingTieredBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingTieredBPSPrice From(Models::NewFloatingTieredBPSPrice value) + public static NewFloatingTieredBPSPriceVariant From(NewFloatingTieredBPSPrice value) { return new(value); } @@ -123,14 +109,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBPSPrice(Models::NewFloatingBPSPrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBPSPriceVariant(NewFloatingBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingBPSPrice From(Models::NewFloatingBPSPrice value) + public static NewFloatingBPSPriceVariant From(NewFloatingBPSPrice value) { return new(value); } @@ -141,14 +125,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkBPSPrice(Models::NewFloatingBulkBPSPrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkBPSPriceVariant(NewFloatingBulkBPSPrice Value) + : Price1, + IVariant { - public static NewFloatingBulkBPSPrice From(Models::NewFloatingBulkBPSPrice value) + public static NewFloatingBulkBPSPriceVariant From(NewFloatingBulkBPSPrice value) { return new(value); } @@ -159,14 +141,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewFloatingBulkPrice(Models::NewFloatingBulkPrice Value) - : AddProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewFloatingBulkPriceVariant(NewFloatingBulkPrice Value) + : Price1, + IVariant { - public static NewFloatingBulkPrice From(Models::NewFloatingBulkPrice value) + public static NewFloatingBulkPriceVariant From(NewFloatingBulkPrice value) { return new(value); } @@ -177,23 +157,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingThresholdTotalAmountPriceVariant, + NewFloatingThresholdTotalAmountPrice >) )] -public sealed record class NewFloatingThresholdTotalAmountPrice( - Models::NewFloatingThresholdTotalAmountPrice Value +public sealed record class NewFloatingThresholdTotalAmountPriceVariant( + NewFloatingThresholdTotalAmountPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingThresholdTotalAmountPrice, - Models::NewFloatingThresholdTotalAmountPrice - > + : Price1, + IVariant { - public static NewFloatingThresholdTotalAmountPrice From( - Models::NewFloatingThresholdTotalAmountPrice value + public static NewFloatingThresholdTotalAmountPriceVariant From( + NewFloatingThresholdTotalAmountPrice value ) { return new(value); @@ -205,19 +182,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackagePrice, - Models::NewFloatingTieredPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingTieredPackagePrice( - Models::NewFloatingTieredPackagePrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredPackagePriceVariant(NewFloatingTieredPackagePrice Value) + : Price1, + IVariant { - public static NewFloatingTieredPackagePrice From(Models::NewFloatingTieredPackagePrice value) + public static NewFloatingTieredPackagePriceVariant From(NewFloatingTieredPackagePrice value) { return new(value); } @@ -228,19 +200,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPrice, - Models::NewFloatingGroupedTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewFloatingGroupedTieredPrice( - Models::NewFloatingGroupedTieredPrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingGroupedTieredPriceVariant(NewFloatingGroupedTieredPrice Value) + : Price1, + IVariant { - public static NewFloatingGroupedTieredPrice From(Models::NewFloatingGroupedTieredPrice value) + public static NewFloatingGroupedTieredPriceVariant From(NewFloatingGroupedTieredPrice value) { return new(value); } @@ -251,23 +218,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice >) )] -public sealed record class NewFloatingMaxGroupTieredPackagePrice( - Models::NewFloatingMaxGroupTieredPackagePrice Value +public sealed record class NewFloatingMaxGroupTieredPackagePriceVariant( + NewFloatingMaxGroupTieredPackagePrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingMaxGroupTieredPackagePrice, - Models::NewFloatingMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewFloatingMaxGroupTieredPackagePriceVariant, + NewFloatingMaxGroupTieredPackagePrice > { - public static NewFloatingMaxGroupTieredPackagePrice From( - Models::NewFloatingMaxGroupTieredPackagePrice value + public static NewFloatingMaxGroupTieredPackagePriceVariant From( + NewFloatingMaxGroupTieredPackagePrice value ) { return new(value); @@ -279,20 +246,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithMinimumPrice, - Models::NewFloatingTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithMinimumPriceVariant, + NewFloatingTieredWithMinimumPrice >) )] -public sealed record class NewFloatingTieredWithMinimumPrice( - Models::NewFloatingTieredWithMinimumPrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingTieredWithMinimumPriceVariant( + NewFloatingTieredWithMinimumPrice Value +) : Price1, IVariant { - public static NewFloatingTieredWithMinimumPrice From( - Models::NewFloatingTieredWithMinimumPrice value + public static NewFloatingTieredWithMinimumPriceVariant From( + NewFloatingTieredWithMinimumPrice value ) { return new(value); @@ -304,23 +269,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice >) )] -public sealed record class NewFloatingPackageWithAllocationPrice( - Models::NewFloatingPackageWithAllocationPrice Value +public sealed record class NewFloatingPackageWithAllocationPriceVariant( + NewFloatingPackageWithAllocationPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingPackageWithAllocationPrice, - Models::NewFloatingPackageWithAllocationPrice + : Price1, + IVariant< + NewFloatingPackageWithAllocationPriceVariant, + NewFloatingPackageWithAllocationPrice > { - public static NewFloatingPackageWithAllocationPrice From( - Models::NewFloatingPackageWithAllocationPrice value + public static NewFloatingPackageWithAllocationPriceVariant From( + NewFloatingPackageWithAllocationPrice value ) { return new(value); @@ -332,23 +297,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice >) )] -public sealed record class NewFloatingTieredPackageWithMinimumPrice( - Models::NewFloatingTieredPackageWithMinimumPrice Value +public sealed record class NewFloatingTieredPackageWithMinimumPriceVariant( + NewFloatingTieredPackageWithMinimumPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingTieredPackageWithMinimumPrice, - Models::NewFloatingTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewFloatingTieredPackageWithMinimumPriceVariant, + NewFloatingTieredPackageWithMinimumPrice > { - public static NewFloatingTieredPackageWithMinimumPrice From( - Models::NewFloatingTieredPackageWithMinimumPrice value + public static NewFloatingTieredPackageWithMinimumPriceVariant From( + NewFloatingTieredPackageWithMinimumPrice value ) { return new(value); @@ -360,21 +325,17 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithPercentPrice, - Models::NewFloatingUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithPercentPriceVariant, + NewFloatingUnitWithPercentPrice >) )] -public sealed record class NewFloatingUnitWithPercentPrice( - Models::NewFloatingUnitWithPercentPrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingUnitWithPercentPriceVariant( + NewFloatingUnitWithPercentPrice Value +) : Price1, IVariant { - public static NewFloatingUnitWithPercentPrice From( - Models::NewFloatingUnitWithPercentPrice value - ) + public static NewFloatingUnitWithPercentPriceVariant From(NewFloatingUnitWithPercentPrice value) { return new(value); } @@ -385,23 +346,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingTieredWithProrationPriceVariant, + NewFloatingTieredWithProrationPrice >) )] -public sealed record class NewFloatingTieredWithProrationPrice( - Models::NewFloatingTieredWithProrationPrice Value +public sealed record class NewFloatingTieredWithProrationPriceVariant( + NewFloatingTieredWithProrationPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingTieredWithProrationPrice, - Models::NewFloatingTieredWithProrationPrice - > + : Price1, + IVariant { - public static NewFloatingTieredWithProrationPrice From( - Models::NewFloatingTieredWithProrationPrice value + public static NewFloatingTieredWithProrationPriceVariant From( + NewFloatingTieredWithProrationPrice value ) { return new(value); @@ -413,20 +371,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingUnitWithProrationPrice, - Models::NewFloatingUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingUnitWithProrationPriceVariant, + NewFloatingUnitWithProrationPrice >) )] -public sealed record class NewFloatingUnitWithProrationPrice( - Models::NewFloatingUnitWithProrationPrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingUnitWithProrationPriceVariant( + NewFloatingUnitWithProrationPrice Value +) : Price1, IVariant { - public static NewFloatingUnitWithProrationPrice From( - Models::NewFloatingUnitWithProrationPrice value + public static NewFloatingUnitWithProrationPriceVariant From( + NewFloatingUnitWithProrationPrice value ) { return new(value); @@ -438,20 +394,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedAllocationPrice, - Models::NewFloatingGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedAllocationPriceVariant, + NewFloatingGroupedAllocationPrice >) )] -public sealed record class NewFloatingGroupedAllocationPrice( - Models::NewFloatingGroupedAllocationPrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingGroupedAllocationPriceVariant( + NewFloatingGroupedAllocationPrice Value +) : Price1, IVariant { - public static NewFloatingGroupedAllocationPrice From( - Models::NewFloatingGroupedAllocationPrice value + public static NewFloatingGroupedAllocationPriceVariant From( + NewFloatingGroupedAllocationPrice value ) { return new(value); @@ -463,23 +417,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithProratedMinimumPrice( - Models::NewFloatingGroupedWithProratedMinimumPrice Value +public sealed record class NewFloatingGroupedWithProratedMinimumPriceVariant( + NewFloatingGroupedWithProratedMinimumPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingGroupedWithProratedMinimumPrice, - Models::NewFloatingGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewFloatingGroupedWithProratedMinimumPriceVariant, + NewFloatingGroupedWithProratedMinimumPrice > { - public static NewFloatingGroupedWithProratedMinimumPrice From( - Models::NewFloatingGroupedWithProratedMinimumPrice value + public static NewFloatingGroupedWithProratedMinimumPriceVariant From( + NewFloatingGroupedWithProratedMinimumPrice value ) { return new(value); @@ -491,23 +445,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewFloatingGroupedWithMeteredMinimumPrice( - Models::NewFloatingGroupedWithMeteredMinimumPrice Value +public sealed record class NewFloatingGroupedWithMeteredMinimumPriceVariant( + NewFloatingGroupedWithMeteredMinimumPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingGroupedWithMeteredMinimumPrice, - Models::NewFloatingGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewFloatingGroupedWithMeteredMinimumPriceVariant, + NewFloatingGroupedWithMeteredMinimumPrice > { - public static NewFloatingGroupedWithMeteredMinimumPrice From( - Models::NewFloatingGroupedWithMeteredMinimumPrice value + public static NewFloatingGroupedWithMeteredMinimumPriceVariant From( + NewFloatingGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -519,23 +473,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice >) )] -public sealed record class NewFloatingMatrixWithDisplayNamePrice( - Models::NewFloatingMatrixWithDisplayNamePrice Value +public sealed record class NewFloatingMatrixWithDisplayNamePriceVariant( + NewFloatingMatrixWithDisplayNamePrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingMatrixWithDisplayNamePrice, - Models::NewFloatingMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewFloatingMatrixWithDisplayNamePriceVariant, + NewFloatingMatrixWithDisplayNamePrice > { - public static NewFloatingMatrixWithDisplayNamePrice From( - Models::NewFloatingMatrixWithDisplayNamePrice value + public static NewFloatingMatrixWithDisplayNamePriceVariant From( + NewFloatingMatrixWithDisplayNamePrice value ) { return new(value); @@ -547,20 +501,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingBulkWithProrationPrice, - Models::NewFloatingBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingBulkWithProrationPriceVariant, + NewFloatingBulkWithProrationPrice >) )] -public sealed record class NewFloatingBulkWithProrationPrice( - Models::NewFloatingBulkWithProrationPrice Value -) - : AddProperties::Price, - Orb::IVariant +public sealed record class NewFloatingBulkWithProrationPriceVariant( + NewFloatingBulkWithProrationPrice Value +) : Price1, IVariant { - public static NewFloatingBulkWithProrationPrice From( - Models::NewFloatingBulkWithProrationPrice value + public static NewFloatingBulkWithProrationPriceVariant From( + NewFloatingBulkWithProrationPrice value ) { return new(value); @@ -572,23 +524,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingGroupedTieredPackagePriceVariant, + NewFloatingGroupedTieredPackagePrice >) )] -public sealed record class NewFloatingGroupedTieredPackagePrice( - Models::NewFloatingGroupedTieredPackagePrice Value +public sealed record class NewFloatingGroupedTieredPackagePriceVariant( + NewFloatingGroupedTieredPackagePrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingGroupedTieredPackagePrice, - Models::NewFloatingGroupedTieredPackagePrice - > + : Price1, + IVariant { - public static NewFloatingGroupedTieredPackagePrice From( - Models::NewFloatingGroupedTieredPackagePrice value + public static NewFloatingGroupedTieredPackagePriceVariant From( + NewFloatingGroupedTieredPackagePrice value ) { return new(value); @@ -600,23 +549,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithUnitPricingPrice( - Models::NewFloatingScalableMatrixWithUnitPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithUnitPricingPriceVariant( + NewFloatingScalableMatrixWithUnitPricingPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingScalableMatrixWithUnitPricingPrice, - Models::NewFloatingScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewFloatingScalableMatrixWithUnitPricingPriceVariant, + NewFloatingScalableMatrixWithUnitPricingPrice > { - public static NewFloatingScalableMatrixWithUnitPricingPrice From( - Models::NewFloatingScalableMatrixWithUnitPricingPrice value + public static NewFloatingScalableMatrixWithUnitPricingPriceVariant From( + NewFloatingScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -628,23 +577,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewFloatingScalableMatrixWithTieredPricingPrice( - Models::NewFloatingScalableMatrixWithTieredPricingPrice Value +public sealed record class NewFloatingScalableMatrixWithTieredPricingPriceVariant( + NewFloatingScalableMatrixWithTieredPricingPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingScalableMatrixWithTieredPricingPrice, - Models::NewFloatingScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewFloatingScalableMatrixWithTieredPricingPriceVariant, + NewFloatingScalableMatrixWithTieredPricingPrice > { - public static NewFloatingScalableMatrixWithTieredPricingPrice From( - Models::NewFloatingScalableMatrixWithTieredPricingPrice value + public static NewFloatingScalableMatrixWithTieredPricingPriceVariant From( + NewFloatingScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -656,23 +605,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice >) )] -public sealed record class NewFloatingCumulativeGroupedBulkPrice( - Models::NewFloatingCumulativeGroupedBulkPrice Value +public sealed record class NewFloatingCumulativeGroupedBulkPriceVariant( + NewFloatingCumulativeGroupedBulkPrice Value ) - : AddProperties::Price, - Orb::IVariant< - NewFloatingCumulativeGroupedBulkPrice, - Models::NewFloatingCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewFloatingCumulativeGroupedBulkPriceVariant, + NewFloatingCumulativeGroupedBulkPrice > { - public static NewFloatingCumulativeGroupedBulkPrice From( - Models::NewFloatingCumulativeGroupedBulkPrice value + public static NewFloatingCumulativeGroupedBulkPriceVariant From( + NewFloatingCumulativeGroupedBulkPrice value ) { return new(value); diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDate.cs index 17a8cab1..eb0c6ab1 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDate.cs @@ -1,6 +1,4 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using StartDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.StartDateVariants; using System = System; @@ -10,16 +8,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ad /// The start date of the price interval. This is the date that the price will start /// billing on the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class StartDate { internal StartDate() { } - public static StartDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator StartDate(System::DateTime value) => + new StartDateVariants::DateTime(value); - public static StartDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator StartDate(BillingCycleRelativeDate value) => + new StartDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDateVariants/All.cs index 1b299366..0ed18216 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/AddProperties/StartDateVariants/All.cs @@ -1,15 +1,12 @@ -using AddProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.StartDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : AddProperties::StartDate, - Orb::IVariant + : StartDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : AddProperties::StartDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : StartDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Edit.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Edit.cs index 4bdbbdb9..8b27ae70 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Edit.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/Edit.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using EditProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Edit : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Edit : ModelBase, IFromRaw { /// /// The id of the price interval to edit. @@ -18,19 +17,16 @@ public required string PriceIntervalID { get { - if (!this.Properties.TryGetValue("price_interval_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_interval_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_interval_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price_interval_id"); } - set - { - this.Properties["price_interval_id"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["price_interval_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -42,15 +38,12 @@ public long? BillingCycleDay { get { - if (!this.Properties.TryGetValue("billing_cycle_day", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("billing_cycle_day", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["billing_cycle_day"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["billing_cycle_day"] = JsonSerializer.SerializeToElement(value); } } /// @@ -61,12 +54,12 @@ public long? BillingCycleDay { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,12 +71,12 @@ public string? Filter { get { - if (!this.Properties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filter"] = JsonSerializer.SerializeToElement(value); } } /// @@ -91,26 +84,27 @@ public string? Filter /// that this list will overwrite all existing fixed fee quantity transitions on /// the price interval. /// - public Generic::List? FixedFeeQuantityTransitions + public List? FixedFeeQuantityTransitions { get { if ( !this.Properties.TryGetValue( "fixed_fee_quantity_transitions", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.Properties["fixed_fee_quantity_transitions"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["fixed_fee_quantity_transitions"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -122,12 +116,12 @@ public string? Filter { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -138,19 +132,16 @@ public string? Filter /// usage_customer_ids must be either the customer for this subscription itself, /// or any of that customer's children. /// - public Generic::List? UsageCustomerIDs + public List? UsageCustomerIDs { get { - if (!this.Properties.TryGetValue("usage_customer_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_customer_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -173,14 +164,14 @@ public override void Validate() public Edit() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Edit(Generic::Dictionary properties) + [SetsRequiredMembers] + Edit(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Edit FromRawUnchecked(Generic::Dictionary properties) + public static Edit FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustment.cs index 401b8b48..45dd3613 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using EditAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class EditAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class EditAdjustment : ModelBase, IFromRaw { /// /// The id of the adjustment interval to edit. @@ -18,25 +17,18 @@ public required string AdjustmentIntervalID { get { - if ( - !this.Properties.TryGetValue( - "adjustment_interval_id", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("adjustment_interval_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "adjustment_interval_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("adjustment_interval_id"); } set { - this.Properties["adjustment_interval_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["adjustment_interval_id"] = JsonSerializer.SerializeToElement(value); } } @@ -48,12 +40,12 @@ public required string AdjustmentIntervalID { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -64,12 +56,12 @@ public required string AdjustmentIntervalID { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -82,16 +74,14 @@ public override void Validate() public EditAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - EditAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + EditAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static EditAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static EditAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDate.cs index 20f5d933..e552c58e 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDate.cs @@ -1,7 +1,5 @@ +using System.Text.Json.Serialization; using EndDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties.EndDateVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties; @@ -10,16 +8,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ed /// The updated end date of this adjustment interval. If not specified, the end date /// will not be updated. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class EndDate { internal EndDate() { } - public static EndDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator EndDate(System::DateTime value) => + new EndDateVariants::DateTime(value); - public static EndDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator EndDate(BillingCycleRelativeDate value) => + new EndDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDateVariants/All.cs index 0607b7c7..a67c6e5d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/EndDateVariants/All.cs @@ -1,15 +1,12 @@ -using EditAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties.EndDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : EditAdjustmentProperties::EndDate, - Orb::IVariant + : EndDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : EditAdjustmentProperties::EndDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : EndDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDate.cs index b1e7bfad..b75cbf1a 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDate.cs @@ -1,6 +1,4 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using StartDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties.StartDateVariants; using System = System; @@ -10,16 +8,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ed /// The updated start date of this adjustment interval. If not specified, the start /// date will not be updated. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class StartDate { internal StartDate() { } - public static StartDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator StartDate(System::DateTime value) => + new StartDateVariants::DateTime(value); - public static StartDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator StartDate(BillingCycleRelativeDate value) => + new StartDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDateVariants/All.cs index 1c56f39d..e07e9831 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditAdjustmentProperties/StartDateVariants/All.cs @@ -1,15 +1,12 @@ -using EditAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditAdjustmentProperties.StartDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : EditAdjustmentProperties::StartDate, - Orb::IVariant + : StartDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : EditAdjustmentProperties::StartDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : StartDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDate.cs index 1881c253..54d99342 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDate.cs @@ -1,7 +1,5 @@ +using System.Text.Json.Serialization; using EndDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties.EndDateVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties; @@ -10,16 +8,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ed /// The updated end date of this price interval. If not specified, the end date will /// not be updated. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class EndDate { internal EndDate() { } - public static EndDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator EndDate(System::DateTime value) => + new EndDateVariants::DateTime(value); - public static EndDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator EndDate(BillingCycleRelativeDate value) => + new EndDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDateVariants/All.cs index f03b9b91..d4c038c2 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/EndDateVariants/All.cs @@ -1,15 +1,12 @@ -using EditProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties.EndDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : EditProperties::EndDate, - Orb::IVariant + : EndDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : EditProperties::EndDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : EndDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/FixedFeeQuantityTransition.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/FixedFeeQuantityTransition1.cs similarity index 52% rename from src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/FixedFeeQuantityTransition.cs rename to src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/FixedFeeQuantityTransition1.cs index 008c7be2..61a4fe8f 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/FixedFeeQuantityTransition.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/FixedFeeQuantityTransition1.cs @@ -1,16 +1,15 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class FixedFeeQuantityTransition - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class FixedFeeQuantityTransition1 + : ModelBase, + IFromRaw { /// /// The date that the fixed fee quantity transition should take effect. @@ -19,15 +18,15 @@ public sealed record class FixedFeeQuantityTransition { get { - if (!this.Properties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("effective_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "effective_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["effective_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -37,15 +36,15 @@ public required long Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -54,18 +53,18 @@ public override void Validate() _ = this.Quantity; } - public FixedFeeQuantityTransition() { } + public FixedFeeQuantityTransition1() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - FixedFeeQuantityTransition(Generic::Dictionary properties) + [SetsRequiredMembers] + FixedFeeQuantityTransition1(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static FixedFeeQuantityTransition FromRawUnchecked( - Generic::Dictionary properties + public static FixedFeeQuantityTransition1 FromRawUnchecked( + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDate.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDate.cs index 9e83938d..3cee7ec4 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDate.cs @@ -1,6 +1,4 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using StartDateVariants = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties.StartDateVariants; using System = System; @@ -10,16 +8,16 @@ namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.Ed /// The updated start date of this price interval. If not specified, the start date /// will not be updated. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class StartDate { internal StartDate() { } - public static StartDateVariants::DateTime Create(System::DateTime value) => new(value); + public static implicit operator StartDate(System::DateTime value) => + new StartDateVariants::DateTime(value); - public static StartDateVariants::BillingCycleRelativeDate Create( - Models::BillingCycleRelativeDate value - ) => new(value); + public static implicit operator StartDate(BillingCycleRelativeDate value) => + new StartDateVariants::BillingCycleRelativeDateVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDateVariants/All.cs index a88151a6..a34f471b 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParamsProperties/EditProperties/StartDateVariants/All.cs @@ -1,15 +1,12 @@ -using EditProperties = Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.EditProperties.StartDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] +[JsonConverter(typeof(VariantConverter))] public sealed record class DateTime(System::DateTime Value) - : EditProperties::StartDate, - Orb::IVariant + : StartDate, + IVariant { public static DateTime From(System::DateTime value) { @@ -19,14 +16,12 @@ public static DateTime From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class BillingCycleRelativeDate(Models::BillingCycleRelativeDate Value) - : EditProperties::StartDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class BillingCycleRelativeDateVariant(BillingCycleRelativeDate Value) + : StartDate, + IVariant { - public static BillingCycleRelativeDate From(Models::BillingCycleRelativeDate value) + public static BillingCycleRelativeDateVariant From(BillingCycleRelativeDate value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountInterval.cs b/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountInterval.cs index 91af98b2..89f52e19 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountInterval.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountInterval.cs @@ -1,26 +1,21 @@ +using System.Text.Json.Serialization; using DiscountIntervalVariants = Orb.Models.Subscriptions.SubscriptionProperties.DiscountIntervalVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionProperties; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class DiscountInterval { internal DiscountInterval() { } - public static DiscountIntervalVariants::AmountDiscountInterval Create( - Models::AmountDiscountInterval value - ) => new(value); + public static implicit operator DiscountInterval(AmountDiscountInterval value) => + new DiscountIntervalVariants::AmountDiscountIntervalVariant(value); - public static DiscountIntervalVariants::PercentageDiscountInterval Create( - Models::PercentageDiscountInterval value - ) => new(value); + public static implicit operator DiscountInterval(PercentageDiscountInterval value) => + new DiscountIntervalVariants::PercentageDiscountIntervalVariant(value); - public static DiscountIntervalVariants::UsageDiscountInterval Create( - Models::UsageDiscountInterval value - ) => new(value); + public static implicit operator DiscountInterval(UsageDiscountInterval value) => + new DiscountIntervalVariants::UsageDiscountIntervalVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountIntervalVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountIntervalVariants/All.cs index c37064c4..0af2bd43 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountIntervalVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionProperties/DiscountIntervalVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using SubscriptionProperties = Orb.Models.Subscriptions.SubscriptionProperties; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionProperties.DiscountIntervalVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class AmountDiscountInterval(Models::AmountDiscountInterval Value) - : SubscriptionProperties::DiscountInterval, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class AmountDiscountIntervalVariant(AmountDiscountInterval Value) + : DiscountInterval, + IVariant { - public static AmountDiscountInterval From(Models::AmountDiscountInterval value) + public static AmountDiscountIntervalVariant From(AmountDiscountInterval value) { return new(value); } @@ -23,14 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class PercentageDiscountInterval(Models::PercentageDiscountInterval Value) - : SubscriptionProperties::DiscountInterval, - Orb::IVariant +public sealed record class PercentageDiscountIntervalVariant(PercentageDiscountInterval Value) + : DiscountInterval, + IVariant { - public static PercentageDiscountInterval From(Models::PercentageDiscountInterval value) + public static PercentageDiscountIntervalVariant From(PercentageDiscountInterval value) { return new(value); } @@ -41,14 +36,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class UsageDiscountInterval(Models::UsageDiscountInterval Value) - : SubscriptionProperties::DiscountInterval, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class UsageDiscountIntervalVariant(UsageDiscountInterval Value) + : DiscountInterval, + IVariant { - public static UsageDiscountInterval From(Models::UsageDiscountInterval value) + public static UsageDiscountIntervalVariant From(UsageDiscountInterval value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionProperties/Status.cs b/src/Orb/Models/Subscriptions/SubscriptionProperties/Status.cs index 8296f7d6..468bd29b 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionProperties/Status.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionProperties/Status.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Status(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Status(string value) : IEnum { public static readonly Status Active = new("active"); @@ -28,7 +27,7 @@ public Value Known() => "active" => Value.Active, "ended" => Value.Ended, "upcoming" => Value.Upcoming, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParams.cs b/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParams.cs index 006c7ba4..6ea02a37 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParams.cs @@ -1,19 +1,18 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using SubscriptionRedeemCouponParamsProperties = Orb.Models.Subscriptions.SubscriptionRedeemCouponParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; /// /// Redeem a coupon effective at a given time. /// -public sealed record class SubscriptionRedeemCouponParams : Orb::ParamsBase +public sealed record class SubscriptionRedeemCouponParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -21,20 +20,17 @@ public sealed record class SubscriptionRedeemCouponParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("change_option", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("change_option", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "change_option", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("change_option"); } - set - { - this.BodyProperties["change_option"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["change_option"] = JsonSerializer.SerializeToElement(value); } } /// @@ -49,17 +45,18 @@ public bool? AllowInvoiceCreditOrVoid if ( !this.BodyProperties.TryGetValue( "allow_invoice_credit_or_void", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["allow_invoice_credit_or_void"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["allow_invoice_credit_or_void"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -71,12 +68,12 @@ public bool? AllowInvoiceCreditOrVoid { get { - if (!this.BodyProperties.TryGetValue("change_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("change_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["change_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["change_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -86,12 +83,12 @@ public string? CouponID { get { - if (!this.BodyProperties.TryGetValue("coupon_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("coupon_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["coupon_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["coupon_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -101,25 +98,20 @@ public string? CouponRedemptionCode { get { - if ( - !this.BodyProperties.TryGetValue( - "coupon_redemption_code", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("coupon_redemption_code", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["coupon_redemption_code"] = Json::JsonSerializer.SerializeToElement( + this.BodyProperties["coupon_redemption_code"] = JsonSerializer.SerializeToElement( value ); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -130,21 +122,21 @@ public string? CouponRedemptionCode }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParamsProperties/ChangeOption.cs b/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParamsProperties/ChangeOption.cs index ee890584..1c9a7be2 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParamsProperties/ChangeOption.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionRedeemCouponParamsProperties/ChangeOption.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionRedeemCouponParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ChangeOption(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ChangeOption(string value) : IEnum { public static readonly ChangeOption RequestedDate = new("requested_date"); @@ -28,7 +27,7 @@ public Value Known() => "requested_date" => Value.RequestedDate, "end_of_subscription_term" => Value.EndOfSubscriptionTerm, "immediate" => Value.Immediate, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParams.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParams.cs index 2e46e288..d053986a 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParams.cs @@ -1,11 +1,10 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using Models = Orb.Models; -using Orb = Orb; using SubscriptionSchedulePlanChangeParamsProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -167,9 +166,9 @@ namespace Orb.Models.Subscriptions; /// in any fixed fees when making a plan change, adjusting the customer balance as /// needed. For details on this behavior, see [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees). /// -public sealed record class SubscriptionSchedulePlanChangeParams : Orb::ParamsBase +public sealed record class SubscriptionSchedulePlanChangeParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -177,59 +176,53 @@ public sealed record class SubscriptionSchedulePlanChangeParams : Orb::ParamsBas { get { - if (!this.BodyProperties.TryGetValue("change_option", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("change_option", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "change_option", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("change_option"); } - set - { - this.BodyProperties["change_option"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["change_option"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional adjustments to be added to the subscription. (Only available for /// accounts that have migrated off of legacy subscription overrides) /// - public Generic::List? AddAdjustments + public List? AddAdjustments { get { - if (!this.BodyProperties.TryGetValue("add_adjustments", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["add_adjustments"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["add_adjustments"] = JsonSerializer.SerializeToElement(value); } } /// /// Additional prices to be added to the subscription. (Only available for accounts /// that have migrated off of legacy subscription overrides) /// - public Generic::List? AddPrices + public List? AddPrices { get { - if (!this.BodyProperties.TryGetValue("add_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("add_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set { this.BodyProperties["add_prices"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["add_prices"] = JsonSerializer.SerializeToElement(value); } } /// @@ -243,17 +236,17 @@ public bool? AlignBillingWithPlanChangeDate if ( !this.BodyProperties.TryGetValue( "align_billing_with_plan_change_date", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["align_billing_with_plan_change_date"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -266,15 +259,12 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("auto_collection", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -287,21 +277,19 @@ public bool? AutoCollection get { if ( - !this.BodyProperties.TryGetValue( - "billing_cycle_alignment", - out Json::JsonElement element - ) + !this.BodyProperties.TryGetValue("billing_cycle_alignment", out JsonElement element) ) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } set { - this.BodyProperties["billing_cycle_alignment"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["billing_cycle_alignment"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -312,19 +300,17 @@ public bool? AutoCollection if ( !this.BodyProperties.TryGetValue( "billing_cycle_anchor_configuration", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize( - element - ); + return JsonSerializer.Deserialize(element); } set { this.BodyProperties["billing_cycle_anchor_configuration"] = - Json::JsonSerializer.SerializeToElement(value); + JsonSerializer.SerializeToElement(value); } } @@ -337,12 +323,12 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("change_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("change_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["change_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["change_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -354,19 +340,14 @@ public string? CouponRedemptionCode { get { - if ( - !this.BodyProperties.TryGetValue( - "coupon_redemption_code", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("coupon_redemption_code", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["coupon_redemption_code"] = Json::JsonSerializer.SerializeToElement( + this.BodyProperties["coupon_redemption_code"] = JsonSerializer.SerializeToElement( value ); } @@ -376,21 +357,14 @@ public double? CreditsOverageRate { get { - if ( - !this.BodyProperties.TryGetValue( - "credits_overage_rate", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("credits_overage_rate", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["credits_overage_rate"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["credits_overage_rate"] = JsonSerializer.SerializeToElement(value); } } @@ -402,21 +376,14 @@ public string? DefaultInvoiceMemo { get { - if ( - !this.BodyProperties.TryGetValue( - "default_invoice_memo", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("default_invoice_memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } @@ -428,17 +395,12 @@ public string? ExternalPlanID { get { - if (!this.BodyProperties.TryGetValue("external_plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("external_plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["external_plan_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["external_plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -450,12 +412,12 @@ public string? Filter { get { - if (!this.BodyProperties.TryGetValue("filter", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("filter", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["filter"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["filter"] = JsonSerializer.SerializeToElement(value); } } /// @@ -465,21 +427,14 @@ public long? InitialPhaseOrder { get { - if ( - !this.BodyProperties.TryGetValue( - "initial_phase_order", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("initial_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["initial_phase_order"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["initial_phase_order"] = JsonSerializer.SerializeToElement(value); } } @@ -492,21 +447,14 @@ public string? InvoicingThreshold { get { - if ( - !this.BodyProperties.TryGetValue( - "invoicing_threshold", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("invoicing_threshold", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["invoicing_threshold"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["invoicing_threshold"] = JsonSerializer.SerializeToElement(value); } } @@ -519,12 +467,12 @@ public long? NetTerms { get { - if (!this.BodyProperties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("net_terms", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["net_terms"] = JsonSerializer.SerializeToElement(value); } } public double? PerCreditOverageAmount @@ -534,17 +482,18 @@ public double? PerCreditOverageAmount if ( !this.BodyProperties.TryGetValue( "per_credit_overage_amount", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["per_credit_overage_amount"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["per_credit_overage_amount"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -556,12 +505,12 @@ public string? PlanID { get { - if (!this.BodyProperties.TryGetValue("plan_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("plan_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["plan_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["plan_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -572,67 +521,50 @@ public long? PlanVersionNumber { get { - if ( - !this.BodyProperties.TryGetValue( - "plan_version_number", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("plan_version_number", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["plan_version_number"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["plan_version_number"] = JsonSerializer.SerializeToElement(value); } } /// /// Optionally provide a list of overrides for prices on the plan /// - public Generic::List? PriceOverrides + public List? PriceOverrides { get { - if (!this.BodyProperties.TryGetValue("price_overrides", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("price_overrides", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.BodyProperties["price_overrides"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize?>(element); } + set { this.BodyProperties["price_overrides"] = JsonSerializer.SerializeToElement(value); } } /// /// Plan adjustments to be removed from the subscription. (Only available for accounts /// that have migrated off of legacy subscription overrides) /// - public Generic::List? RemoveAdjustments + public List? RemoveAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "remove_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("remove_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["remove_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["remove_adjustments"] = JsonSerializer.SerializeToElement(value); } } @@ -640,48 +572,38 @@ public long? PlanVersionNumber /// Plan prices to be removed from the subscription. (Only available for accounts /// that have migrated off of legacy subscription overrides) /// - public Generic::List? RemovePrices + public List? RemovePrices { get { - if (!this.BodyProperties.TryGetValue("remove_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("remove_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["remove_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["remove_prices"] = JsonSerializer.SerializeToElement(value); } } /// /// Plan adjustments to be replaced with additional adjustments on the subscription. /// (Only available for accounts that have migrated off of legacy subscription overrides) /// - public Generic::List? ReplaceAdjustments + public List? ReplaceAdjustments { get { - if ( - !this.BodyProperties.TryGetValue( - "replace_adjustments", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("replace_adjustments", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } set { - this.BodyProperties["replace_adjustments"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["replace_adjustments"] = JsonSerializer.SerializeToElement(value); } } @@ -689,21 +611,18 @@ public long? PlanVersionNumber /// Plan prices to be replaced with additional prices on the subscription. (Only /// available for accounts that have migrated off of legacy subscription overrides) /// - public Generic::List? ReplacePrices + public List? ReplacePrices { get { - if (!this.BodyProperties.TryGetValue("replace_prices", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("replace_prices", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( + return JsonSerializer.Deserialize?>( element ); } - set - { - this.BodyProperties["replace_prices"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["replace_prices"] = JsonSerializer.SerializeToElement(value); } } /// @@ -715,21 +634,14 @@ public long? TrialDurationDays { get { - if ( - !this.BodyProperties.TryGetValue( - "trial_duration_days", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("trial_duration_days", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["trial_duration_days"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["trial_duration_days"] = JsonSerializer.SerializeToElement(value); } } @@ -741,29 +653,22 @@ public long? TrialDurationDays /// usage_customer_ids must be either the customer for this subscription itself, /// or any of that customer's children. /// - public Generic::List? UsageCustomerIDs + public List? UsageCustomerIDs { get { - if ( - !this.BodyProperties.TryGetValue( - "usage_customer_ids", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("usage_customer_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } set { - this.BodyProperties["usage_customer_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["usage_customer_ids"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -774,21 +679,21 @@ public long? TrialDurationDays }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustment.cs index 3cbeba82..7ffa9267 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustment.cs @@ -1,15 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddAdjustmentProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the subscription. @@ -18,32 +17,29 @@ public sealed record class AddAdjustment : Orb::ModelBase, Orb::IFromRaw(element) - ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// /// The end date of the adjustment interval. This is the date that the adjustment /// will stop affecting prices on the subscription. /// - public System::DateTime? EndDate + public DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -53,15 +49,12 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// @@ -69,16 +62,16 @@ public long? PlanPhaseOrder /// will start affecting prices on the subscription. If null, the adjustment will /// start when the phase or subscription starts. /// - public System::DateTime? StartDate + public DateTime? StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -92,16 +85,14 @@ public override void Validate() public AddAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + AddAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/Adjustment.cs index 348ab66f..6010801d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs index c0e05eb9..365308ec 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using AddAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddAdjustmentProperties; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : AddAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPrice.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPrice.cs index 24e1a30c..6a7749f5 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPrice.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPrice.cs @@ -1,67 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using AddPriceProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties; -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class AddPrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class AddPrice : ModelBase, IFromRaw { /// /// The definition of a new allocation price to create and add to the subscription. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// /// [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this price. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// /// The end date of the price interval. This is the date that the price will stop /// billing on the subscription. If null, billing will end when the phase or subscription ends. /// - public System::DateTime? EndDate + public DateTime? EndDate { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -71,15 +63,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -90,12 +79,12 @@ public string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -106,12 +95,12 @@ public string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,30 +110,27 @@ public long? PlanPhaseOrder { get { - if (!this.Properties.TryGetValue("plan_phase_order", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("plan_phase_order", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["plan_phase_order"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["plan_phase_order"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new price to create and add to the subscription. /// - public AddPriceProperties::Price? Price + public AddPriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -154,12 +140,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -167,16 +153,16 @@ public string? PriceID /// start billing on the subscription. If null, billing will start when the phase /// or subscription starts. /// - public System::DateTime? StartDate + public DateTime? StartDate { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -199,16 +185,14 @@ public override void Validate() public AddPrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - AddPrice(Generic::Dictionary properties) + [SetsRequiredMembers] + AddPrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static AddPrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static AddPrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/Price.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/Price.cs deleted file mode 100644 index 5bfae501..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/Price.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Orb = Orb; -using PriceVariants = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; - -namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties; - -/// -/// The definition of a new price to create and add to the subscription. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewSubscriptionUnitPrice Create( - Subscriptions::NewSubscriptionUnitPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackagePrice Create( - Subscriptions::NewSubscriptionPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixPrice Create( - Subscriptions::NewSubscriptionMatrixPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPrice Create( - Subscriptions::NewSubscriptionTieredPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredBPSPrice Create( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBPSPrice Create( - Subscriptions::NewSubscriptionBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkBPSPrice Create( - Subscriptions::NewSubscriptionBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkPrice Create( - Subscriptions::NewSubscriptionBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionThresholdTotalAmountPrice Create( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackagePrice Create( - Subscriptions::NewSubscriptionTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithPercentPrice Create( - Subscriptions::NewSubscriptionUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackageWithAllocationPrice Create( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTierWithProrationPrice Create( - Subscriptions::NewSubscriptionTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithProrationPrice Create( - Subscriptions::NewSubscriptionUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedAllocationPrice Create( - Subscriptions::NewSubscriptionGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithProratedMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkWithProrationPrice Create( - Subscriptions::NewSubscriptionBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionCumulativeGroupedBulkPrice Create( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMaxGroupTieredPackagePrice Create( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithDisplayNamePrice Create( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPackagePrice Create( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithAllocationPrice Create( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackageWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPrice Create( - Subscriptions::NewSubscriptionGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/Price1.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/Price1.cs new file mode 100644 index 00000000..fb19b91f --- /dev/null +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/Price1.cs @@ -0,0 +1,101 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties.PriceVariants; + +namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties; + +/// +/// The definition of a new price to create and add to the subscription. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewSubscriptionUnitPrice value) => + new PriceVariants::NewSubscriptionUnitPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackagePrice value) => + new PriceVariants::NewSubscriptionPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixPrice value) => + new PriceVariants::NewSubscriptionMatrixPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPrice value) => + new PriceVariants::NewSubscriptionTieredPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredBPSPrice value) => + new PriceVariants::NewSubscriptionTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBPSPrice value) => + new PriceVariants::NewSubscriptionBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkBPSPrice value) => + new PriceVariants::NewSubscriptionBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkPrice value) => + new PriceVariants::NewSubscriptionBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionThresholdTotalAmountPrice value) => + new PriceVariants::NewSubscriptionThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackagePrice value) => + new PriceVariants::NewSubscriptionTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithPercentPrice value) => + new PriceVariants::NewSubscriptionUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackageWithAllocationPrice value) => + new PriceVariants::NewSubscriptionPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTierWithProrationPrice value) => + new PriceVariants::NewSubscriptionTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithProrationPrice value) => + new PriceVariants::NewSubscriptionUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedAllocationPrice value) => + new PriceVariants::NewSubscriptionGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkWithProrationPrice value) => + new PriceVariants::NewSubscriptionBulkWithProrationPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithUnitPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithTieredPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionCumulativeGroupedBulkPrice value) => + new PriceVariants::NewSubscriptionCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMaxGroupTieredPackagePrice value) => + new PriceVariants::NewSubscriptionMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithDisplayNamePrice value) => + new PriceVariants::NewSubscriptionMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPackagePrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithAllocationPrice value) => + new PriceVariants::NewSubscriptionMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackageWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/PriceVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/PriceVariants/All.cs index aee850e7..43ebbed3 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/AddPriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using AddPriceProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionUnitPrice(Subscriptions::NewSubscriptionUnitPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionUnitPriceVariant(NewSubscriptionUnitPrice Value) + : Price1, + IVariant { - public static NewSubscriptionUnitPrice From(Subscriptions::NewSubscriptionUnitPrice value) + public static NewSubscriptionUnitPriceVariant From(NewSubscriptionUnitPrice value) { return new(value); } @@ -23,19 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackagePrice, - Subscriptions::NewSubscriptionPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionPackagePrice( - Subscriptions::NewSubscriptionPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionPackagePriceVariant(NewSubscriptionPackagePrice Value) + : Price1, + IVariant { - public static NewSubscriptionPackagePrice From(Subscriptions::NewSubscriptionPackagePrice value) + public static NewSubscriptionPackagePriceVariant From(NewSubscriptionPackagePrice value) { return new(value); } @@ -46,19 +36,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixPrice, - Subscriptions::NewSubscriptionMatrixPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionMatrixPrice( - Subscriptions::NewSubscriptionMatrixPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionMatrixPriceVariant(NewSubscriptionMatrixPrice Value) + : Price1, + IVariant { - public static NewSubscriptionMatrixPrice From(Subscriptions::NewSubscriptionMatrixPrice value) + public static NewSubscriptionMatrixPriceVariant From(NewSubscriptionMatrixPrice value) { return new(value); } @@ -69,19 +54,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPrice, - Subscriptions::NewSubscriptionTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredPrice( - Subscriptions::NewSubscriptionTieredPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredPriceVariant(NewSubscriptionTieredPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredPrice From(Subscriptions::NewSubscriptionTieredPrice value) + public static NewSubscriptionTieredPriceVariant From(NewSubscriptionTieredPrice value) { return new(value); } @@ -92,21 +72,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredBPSPrice, - Subscriptions::NewSubscriptionTieredBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredBPSPrice( - Subscriptions::NewSubscriptionTieredBPSPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredBPSPriceVariant(NewSubscriptionTieredBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredBPSPrice From( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) + public static NewSubscriptionTieredBPSPriceVariant From(NewSubscriptionTieredBPSPrice value) { return new(value); } @@ -117,14 +90,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBPSPrice(Subscriptions::NewSubscriptionBPSPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBPSPriceVariant(NewSubscriptionBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBPSPrice From(Subscriptions::NewSubscriptionBPSPrice value) + public static NewSubscriptionBPSPriceVariant From(NewSubscriptionBPSPrice value) { return new(value); } @@ -135,19 +106,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkBPSPrice, - Subscriptions::NewSubscriptionBulkBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionBulkBPSPrice( - Subscriptions::NewSubscriptionBulkBPSPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionBulkBPSPriceVariant(NewSubscriptionBulkBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkBPSPrice From(Subscriptions::NewSubscriptionBulkBPSPrice value) + public static NewSubscriptionBulkBPSPriceVariant From(NewSubscriptionBulkBPSPrice value) { return new(value); } @@ -158,14 +124,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBulkPrice(Subscriptions::NewSubscriptionBulkPrice Value) - : AddPriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBulkPriceVariant(NewSubscriptionBulkPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkPrice From(Subscriptions::NewSubscriptionBulkPrice value) + public static NewSubscriptionBulkPriceVariant From(NewSubscriptionBulkPrice value) { return new(value); } @@ -176,23 +140,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice >) )] -public sealed record class NewSubscriptionThresholdTotalAmountPrice( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice Value +public sealed record class NewSubscriptionThresholdTotalAmountPriceVariant( + NewSubscriptionThresholdTotalAmountPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice + : Price1, + IVariant< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice > { - public static NewSubscriptionThresholdTotalAmountPrice From( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value + public static NewSubscriptionThresholdTotalAmountPriceVariant From( + NewSubscriptionThresholdTotalAmountPrice value ) { return new(value); @@ -204,23 +168,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackagePriceVariant, + NewSubscriptionTieredPackagePrice >) )] -public sealed record class NewSubscriptionTieredPackagePrice( - Subscriptions::NewSubscriptionTieredPackagePrice Value -) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice - > +public sealed record class NewSubscriptionTieredPackagePriceVariant( + NewSubscriptionTieredPackagePrice Value +) : Price1, IVariant { - public static NewSubscriptionTieredPackagePrice From( - Subscriptions::NewSubscriptionTieredPackagePrice value + public static NewSubscriptionTieredPackagePriceVariant From( + NewSubscriptionTieredPackagePrice value ) { return new(value); @@ -232,23 +191,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredWithMinimumPrice( - Subscriptions::NewSubscriptionTieredWithMinimumPrice Value +public sealed record class NewSubscriptionTieredWithMinimumPriceVariant( + NewSubscriptionTieredWithMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice > { - public static NewSubscriptionTieredWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value + public static NewSubscriptionTieredWithMinimumPriceVariant From( + NewSubscriptionTieredWithMinimumPrice value ) { return new(value); @@ -260,23 +219,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithPercentPriceVariant, + NewSubscriptionUnitWithPercentPrice >) )] -public sealed record class NewSubscriptionUnitWithPercentPrice( - Subscriptions::NewSubscriptionUnitWithPercentPrice Value +public sealed record class NewSubscriptionUnitWithPercentPriceVariant( + NewSubscriptionUnitWithPercentPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice - > + : Price1, + IVariant { - public static NewSubscriptionUnitWithPercentPrice From( - Subscriptions::NewSubscriptionUnitWithPercentPrice value + public static NewSubscriptionUnitWithPercentPriceVariant From( + NewSubscriptionUnitWithPercentPrice value ) { return new(value); @@ -288,23 +244,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice >) )] -public sealed record class NewSubscriptionPackageWithAllocationPrice( - Subscriptions::NewSubscriptionPackageWithAllocationPrice Value +public sealed record class NewSubscriptionPackageWithAllocationPriceVariant( + NewSubscriptionPackageWithAllocationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice > { - public static NewSubscriptionPackageWithAllocationPrice From( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value + public static NewSubscriptionPackageWithAllocationPriceVariant From( + NewSubscriptionPackageWithAllocationPrice value ) { return new(value); @@ -316,23 +272,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice >) )] -public sealed record class NewSubscriptionTierWithProrationPrice( - Subscriptions::NewSubscriptionTierWithProrationPrice Value +public sealed record class NewSubscriptionTierWithProrationPriceVariant( + NewSubscriptionTierWithProrationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice + : Price1, + IVariant< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice > { - public static NewSubscriptionTierWithProrationPrice From( - Subscriptions::NewSubscriptionTierWithProrationPrice value + public static NewSubscriptionTierWithProrationPriceVariant From( + NewSubscriptionTierWithProrationPrice value ) { return new(value); @@ -344,23 +300,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice >) )] -public sealed record class NewSubscriptionUnitWithProrationPrice( - Subscriptions::NewSubscriptionUnitWithProrationPrice Value +public sealed record class NewSubscriptionUnitWithProrationPriceVariant( + NewSubscriptionUnitWithProrationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice + : Price1, + IVariant< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice > { - public static NewSubscriptionUnitWithProrationPrice From( - Subscriptions::NewSubscriptionUnitWithProrationPrice value + public static NewSubscriptionUnitWithProrationPriceVariant From( + NewSubscriptionUnitWithProrationPrice value ) { return new(value); @@ -372,23 +328,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice >) )] -public sealed record class NewSubscriptionGroupedAllocationPrice( - Subscriptions::NewSubscriptionGroupedAllocationPrice Value +public sealed record class NewSubscriptionGroupedAllocationPriceVariant( + NewSubscriptionGroupedAllocationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice + : Price1, + IVariant< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice > { - public static NewSubscriptionGroupedAllocationPrice From( - Subscriptions::NewSubscriptionGroupedAllocationPrice value + public static NewSubscriptionGroupedAllocationPriceVariant From( + NewSubscriptionGroupedAllocationPrice value ) { return new(value); @@ -400,23 +356,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithProratedMinimumPriceVariant( + NewSubscriptionGroupedWithProratedMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice > { - public static NewSubscriptionGroupedWithProratedMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value + public static NewSubscriptionGroupedWithProratedMinimumPriceVariant From( + NewSubscriptionGroupedWithProratedMinimumPrice value ) { return new(value); @@ -428,23 +384,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice >) )] -public sealed record class NewSubscriptionBulkWithProrationPrice( - Subscriptions::NewSubscriptionBulkWithProrationPrice Value +public sealed record class NewSubscriptionBulkWithProrationPriceVariant( + NewSubscriptionBulkWithProrationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice + : Price1, + IVariant< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice > { - public static NewSubscriptionBulkWithProrationPrice From( - Subscriptions::NewSubscriptionBulkWithProrationPrice value + public static NewSubscriptionBulkWithProrationPriceVariant From( + NewSubscriptionBulkWithProrationPrice value ) { return new(value); @@ -456,23 +412,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPriceVariant( + NewSubscriptionScalableMatrixWithUnitPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice > { - public static NewSubscriptionScalableMatrixWithUnitPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value + public static NewSubscriptionScalableMatrixWithUnitPricingPriceVariant From( + NewSubscriptionScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -484,23 +440,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPriceVariant( + NewSubscriptionScalableMatrixWithTieredPricingPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice > { - public static NewSubscriptionScalableMatrixWithTieredPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value + public static NewSubscriptionScalableMatrixWithTieredPricingPriceVariant From( + NewSubscriptionScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -512,23 +468,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice >) )] -public sealed record class NewSubscriptionCumulativeGroupedBulkPrice( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice Value +public sealed record class NewSubscriptionCumulativeGroupedBulkPriceVariant( + NewSubscriptionCumulativeGroupedBulkPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice > { - public static NewSubscriptionCumulativeGroupedBulkPrice From( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value + public static NewSubscriptionCumulativeGroupedBulkPriceVariant From( + NewSubscriptionCumulativeGroupedBulkPrice value ) { return new(value); @@ -540,23 +496,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice >) )] -public sealed record class NewSubscriptionMaxGroupTieredPackagePrice( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice Value +public sealed record class NewSubscriptionMaxGroupTieredPackagePriceVariant( + NewSubscriptionMaxGroupTieredPackagePrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice > { - public static NewSubscriptionMaxGroupTieredPackagePrice From( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value + public static NewSubscriptionMaxGroupTieredPackagePriceVariant From( + NewSubscriptionMaxGroupTieredPackagePrice value ) { return new(value); @@ -568,23 +524,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithMeteredMinimumPriceVariant( + NewSubscriptionGroupedWithMeteredMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice > { - public static NewSubscriptionGroupedWithMeteredMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value + public static NewSubscriptionGroupedWithMeteredMinimumPriceVariant From( + NewSubscriptionGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -596,23 +552,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice >) )] -public sealed record class NewSubscriptionMatrixWithDisplayNamePrice( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice Value +public sealed record class NewSubscriptionMatrixWithDisplayNamePriceVariant( + NewSubscriptionMatrixWithDisplayNamePrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice > { - public static NewSubscriptionMatrixWithDisplayNamePrice From( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value + public static NewSubscriptionMatrixWithDisplayNamePriceVariant From( + NewSubscriptionMatrixWithDisplayNamePrice value ) { return new(value); @@ -624,23 +580,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice >) )] -public sealed record class NewSubscriptionGroupedTieredPackagePrice( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice Value +public sealed record class NewSubscriptionGroupedTieredPackagePriceVariant( + NewSubscriptionGroupedTieredPackagePrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice > { - public static NewSubscriptionGroupedTieredPackagePrice From( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value + public static NewSubscriptionGroupedTieredPackagePriceVariant From( + NewSubscriptionGroupedTieredPackagePrice value ) { return new(value); @@ -652,23 +608,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice >) )] -public sealed record class NewSubscriptionMatrixWithAllocationPrice( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice Value +public sealed record class NewSubscriptionMatrixWithAllocationPriceVariant( + NewSubscriptionMatrixWithAllocationPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice > { - public static NewSubscriptionMatrixWithAllocationPrice From( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value + public static NewSubscriptionMatrixWithAllocationPriceVariant From( + NewSubscriptionMatrixWithAllocationPrice value ) { return new(value); @@ -680,23 +636,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredPackageWithMinimumPrice( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice Value +public sealed record class NewSubscriptionTieredPackageWithMinimumPriceVariant( + NewSubscriptionTieredPackageWithMinimumPrice Value ) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice > { - public static NewSubscriptionTieredPackageWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value + public static NewSubscriptionTieredPackageWithMinimumPriceVariant From( + NewSubscriptionTieredPackageWithMinimumPrice value ) { return new(value); @@ -708,23 +664,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPriceVariant, + NewSubscriptionGroupedTieredPrice >) )] -public sealed record class NewSubscriptionGroupedTieredPrice( - Subscriptions::NewSubscriptionGroupedTieredPrice Value -) - : AddPriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice - > +public sealed record class NewSubscriptionGroupedTieredPriceVariant( + NewSubscriptionGroupedTieredPrice Value +) : Price1, IVariant { - public static NewSubscriptionGroupedTieredPrice From( - Subscriptions::NewSubscriptionGroupedTieredPrice value + public static NewSubscriptionGroupedTieredPriceVariant From( + NewSubscriptionGroupedTieredPrice value ) { return new(value); diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/BillingCycleAlignment.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/BillingCycleAlignment.cs index 317d083c..de5e6aaf 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/BillingCycleAlignment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/BillingCycleAlignment.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; @@ -9,9 +8,9 @@ namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsPropertie /// start of the month. Defaults to `unchanged` which keeps subscription's existing /// billing cycle alignment. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] +[JsonConverter(typeof(EnumConverter))] public sealed record class BillingCycleAlignment(string value) - : Orb::IEnum + : IEnum { public static readonly BillingCycleAlignment Unchanged = new("unchanged"); @@ -34,7 +33,7 @@ public Value Known() => "unchanged" => Value.Unchanged, "plan_change_date" => Value.PlanChangeDate, "start_of_month" => Value.StartOfMonth, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ChangeOption.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ChangeOption.cs index a763dd21..2533276e 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ChangeOption.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ChangeOption.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ChangeOption(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ChangeOption(string value) : IEnum { public static readonly ChangeOption RequestedDate = new("requested_date"); @@ -28,7 +27,7 @@ public Value Known() => "requested_date" => Value.RequestedDate, "end_of_subscription_term" => Value.EndOfSubscriptionTerm, "immediate" => Value.Immediate, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemoveAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemoveAdjustment.cs index 59b46dd3..13ae16c2 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemoveAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemoveAdjustment.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemoveAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemoveAdjustment : ModelBase, IFromRaw { /// /// The id of the adjustment to remove on the subscription. @@ -17,16 +16,13 @@ public required string AdjustmentID { get { - if (!this.Properties.TryGetValue("adjustment_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "adjustment_id", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException("adjustment_id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment_id"); } - set { this.Properties["adjustment_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +33,14 @@ public override void Validate() public RemoveAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemoveAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + RemoveAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemoveAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemoveAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemovePrice.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemovePrice.cs index ffbcd70c..2e9e885c 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemovePrice.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/RemovePrice.cs @@ -1,13 +1,12 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class RemovePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class RemovePrice : ModelBase, IFromRaw { /// /// The external price id of the price to remove on the subscription. @@ -16,15 +15,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -34,12 +30,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -51,16 +47,14 @@ public override void Validate() public RemovePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - RemovePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + RemovePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static RemovePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static RemovePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustment.cs index 0818279f..0ddb9c7d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustment.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplaceAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplaceAdjustment : ModelBase, IFromRaw { /// /// The definition of a new adjustment to create and add to the subscription. @@ -18,17 +17,13 @@ public sealed record class ReplaceAdjustment : Orb::ModelBase, Orb::IFromRaw( - element - ) ?? throw new System::ArgumentNullException("adjustment"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("adjustment"); } - set { this.Properties["adjustment"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); } } /// @@ -38,25 +33,18 @@ public required string ReplacesAdjustmentID { get { - if ( - !this.Properties.TryGetValue( - "replaces_adjustment_id", - out Json::JsonElement element - ) - ) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_adjustment_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_adjustment_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_adjustment_id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_adjustment_id"); } set { - this.Properties["replaces_adjustment_id"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["replaces_adjustment_id"] = JsonSerializer.SerializeToElement(value); } } @@ -69,16 +57,14 @@ public override void Validate() public ReplaceAdjustment() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplaceAdjustment(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplaceAdjustment(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplaceAdjustment FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplaceAdjustment FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs index 1f41f589..1d02b7bc 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/Adjustment.cs @@ -1,31 +1,30 @@ +using System.Text.Json.Serialization; using AdjustmentVariants = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplaceAdjustmentProperties; /// /// The definition of a new adjustment to create and add to the subscription. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class Adjustment { internal Adjustment() { } - public static AdjustmentVariants::NewPercentageDiscount Create( - Models::NewPercentageDiscount value - ) => new(value); + public static implicit operator Adjustment(NewPercentageDiscount value) => + new AdjustmentVariants::NewPercentageDiscountVariant(value); - public static AdjustmentVariants::NewUsageDiscount Create(Models::NewUsageDiscount value) => - new(value); + public static implicit operator Adjustment(NewUsageDiscount value) => + new AdjustmentVariants::NewUsageDiscountVariant(value); - public static AdjustmentVariants::NewAmountDiscount Create(Models::NewAmountDiscount value) => - new(value); + public static implicit operator Adjustment(NewAmountDiscount value) => + new AdjustmentVariants::NewAmountDiscountVariant(value); - public static AdjustmentVariants::NewMinimum Create(Models::NewMinimum value) => new(value); + public static implicit operator Adjustment(NewMinimum value) => + new AdjustmentVariants::NewMinimumVariant(value); - public static AdjustmentVariants::NewMaximum Create(Models::NewMaximum value) => new(value); + public static implicit operator Adjustment(NewMaximum value) => + new AdjustmentVariants::NewMaximumVariant(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs index bccf2497..1d2b0fc8 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplaceAdjustmentProperties/AdjustmentVariants/All.cs @@ -1,18 +1,13 @@ -using Models = Orb.Models; -using Orb = Orb; -using ReplaceAdjustmentProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplaceAdjustmentProperties; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplaceAdjustmentProperties.AdjustmentVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewPercentageDiscount(Models::NewPercentageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewPercentageDiscountVariant(NewPercentageDiscount Value) + : Adjustment, + IVariant { - public static NewPercentageDiscount From(Models::NewPercentageDiscount value) + public static NewPercentageDiscountVariant From(NewPercentageDiscount value) { return new(value); } @@ -23,14 +18,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewUsageDiscount(Models::NewUsageDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewUsageDiscountVariant(NewUsageDiscount Value) + : Adjustment, + IVariant { - public static NewUsageDiscount From(Models::NewUsageDiscount value) + public static NewUsageDiscountVariant From(NewUsageDiscount value) { return new(value); } @@ -41,14 +34,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewAmountDiscount(Models::NewAmountDiscount Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewAmountDiscountVariant(NewAmountDiscount Value) + : Adjustment, + IVariant { - public static NewAmountDiscount From(Models::NewAmountDiscount value) + public static NewAmountDiscountVariant From(NewAmountDiscount value) { return new(value); } @@ -59,12 +50,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMinimum(Models::NewMinimum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMinimumVariant(NewMinimum Value) + : Adjustment, + IVariant { - public static NewMinimum From(Models::NewMinimum value) + public static NewMinimumVariant From(NewMinimum value) { return new(value); } @@ -75,12 +66,12 @@ public override void Validate() } } -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class NewMaximum(Models::NewMaximum Value) - : ReplaceAdjustmentProperties::Adjustment, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewMaximumVariant(NewMaximum Value) + : Adjustment, + IVariant { - public static NewMaximum From(Models::NewMaximum value) + public static NewMaximumVariant From(NewMaximum value) { return new(value); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePrice.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePrice.cs index 348233a7..ef7c1a5e 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePrice.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePrice.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using ReplacePriceProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class ReplacePrice : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class ReplacePrice : ModelBase, IFromRaw { /// /// The id of the price on the plan to replace in the subscription. @@ -20,55 +17,47 @@ public required string ReplacesPriceID { get { - if (!this.Properties.TryGetValue("replaces_price_id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("replaces_price_id", out JsonElement element)) + throw new ArgumentOutOfRangeException( "replaces_price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("replaces_price_id"); - } - set - { - this.Properties["replaces_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("replaces_price_id"); } + set { this.Properties["replaces_price_id"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new allocation price to create and add to the subscription. /// - public Models::NewAllocationPrice? AllocationPrice + public NewAllocationPrice? AllocationPrice { get { - if (!this.Properties.TryGetValue("allocation_price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("allocation_price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["allocation_price"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["allocation_price"] = JsonSerializer.SerializeToElement(value); } } /// /// [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the /// replacement price. /// - public Generic::List? Discounts + public List? Discounts { get { - if (!this.Properties.TryGetValue("discounts", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discounts", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>( - element - ); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["discounts"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discounts"] = JsonSerializer.SerializeToElement(value); } } /// @@ -78,15 +67,12 @@ public string? ExternalPriceID { get { - if (!this.Properties.TryGetValue("external_price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("external_price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["external_price_id"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["external_price_id"] = JsonSerializer.SerializeToElement(value); } } /// @@ -96,17 +82,12 @@ public double? FixedPriceQuantity { get { - if (!this.Properties.TryGetValue("fixed_price_quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("fixed_price_quantity", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["fixed_price_quantity"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["fixed_price_quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,12 +98,12 @@ public string? MaximumAmount { get { - if (!this.Properties.TryGetValue("maximum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("maximum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["maximum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["maximum_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -133,27 +114,27 @@ public string? MinimumAmount { get { - if (!this.Properties.TryGetValue("minimum_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("minimum_amount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["minimum_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["minimum_amount"] = JsonSerializer.SerializeToElement(value); } } /// /// The definition of a new price to create and add to the subscription. /// - public ReplacePriceProperties::Price? Price + public ReplacePriceProperties::Price1? Price { get { - if (!this.Properties.TryGetValue("price", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price"] = JsonSerializer.SerializeToElement(value); } } /// @@ -163,12 +144,12 @@ public string? PriceID { get { - if (!this.Properties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("price_id", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["price_id"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -190,16 +171,14 @@ public override void Validate() public ReplacePrice() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - ReplacePrice(Generic::Dictionary properties) + [SetsRequiredMembers] + ReplacePrice(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static ReplacePrice FromRawUnchecked( - Generic::Dictionary properties - ) + public static ReplacePrice FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/Price.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/Price.cs deleted file mode 100644 index 2b025006..00000000 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/Price.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Orb = Orb; -using PriceVariants = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties.PriceVariants; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; - -namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties; - -/// -/// The definition of a new price to create and add to the subscription. -/// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] -public abstract record class Price -{ - internal Price() { } - - public static PriceVariants::NewSubscriptionUnitPrice Create( - Subscriptions::NewSubscriptionUnitPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackagePrice Create( - Subscriptions::NewSubscriptionPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixPrice Create( - Subscriptions::NewSubscriptionMatrixPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPrice Create( - Subscriptions::NewSubscriptionTieredPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredBPSPrice Create( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBPSPrice Create( - Subscriptions::NewSubscriptionBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkBPSPrice Create( - Subscriptions::NewSubscriptionBulkBPSPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkPrice Create( - Subscriptions::NewSubscriptionBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionThresholdTotalAmountPrice Create( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackagePrice Create( - Subscriptions::NewSubscriptionTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithPercentPrice Create( - Subscriptions::NewSubscriptionUnitWithPercentPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionPackageWithAllocationPrice Create( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTierWithProrationPrice Create( - Subscriptions::NewSubscriptionTierWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionUnitWithProrationPrice Create( - Subscriptions::NewSubscriptionUnitWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedAllocationPrice Create( - Subscriptions::NewSubscriptionGroupedAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithProratedMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionBulkWithProrationPrice Create( - Subscriptions::NewSubscriptionBulkWithProrationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPrice Create( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionCumulativeGroupedBulkPrice Create( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMaxGroupTieredPackagePrice Create( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPrice Create( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithDisplayNamePrice Create( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPackagePrice Create( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionMatrixWithAllocationPrice Create( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionTieredPackageWithMinimumPrice Create( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value - ) => new(value); - - public static PriceVariants::NewSubscriptionGroupedTieredPrice Create( - Subscriptions::NewSubscriptionGroupedTieredPrice value - ) => new(value); - - public abstract void Validate(); -} diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/Price1.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/Price1.cs new file mode 100644 index 00000000..cfff485d --- /dev/null +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/Price1.cs @@ -0,0 +1,101 @@ +using System.Text.Json.Serialization; +using PriceVariants = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties.PriceVariants; + +namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties; + +/// +/// The definition of a new price to create and add to the subscription. +/// +[JsonConverter(typeof(UnionConverter))] +public abstract record class Price1 +{ + internal Price1() { } + + public static implicit operator Price1(NewSubscriptionUnitPrice value) => + new PriceVariants::NewSubscriptionUnitPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackagePrice value) => + new PriceVariants::NewSubscriptionPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixPrice value) => + new PriceVariants::NewSubscriptionMatrixPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPrice value) => + new PriceVariants::NewSubscriptionTieredPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredBPSPrice value) => + new PriceVariants::NewSubscriptionTieredBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBPSPrice value) => + new PriceVariants::NewSubscriptionBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkBPSPrice value) => + new PriceVariants::NewSubscriptionBulkBPSPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkPrice value) => + new PriceVariants::NewSubscriptionBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionThresholdTotalAmountPrice value) => + new PriceVariants::NewSubscriptionThresholdTotalAmountPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackagePrice value) => + new PriceVariants::NewSubscriptionTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithPercentPrice value) => + new PriceVariants::NewSubscriptionUnitWithPercentPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionPackageWithAllocationPrice value) => + new PriceVariants::NewSubscriptionPackageWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTierWithProrationPrice value) => + new PriceVariants::NewSubscriptionTierWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionUnitWithProrationPrice value) => + new PriceVariants::NewSubscriptionUnitWithProrationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedAllocationPrice value) => + new PriceVariants::NewSubscriptionGroupedAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithProratedMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithProratedMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionBulkWithProrationPrice value) => + new PriceVariants::NewSubscriptionBulkWithProrationPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithUnitPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithUnitPricingPriceVariant(value); + + public static implicit operator Price1( + NewSubscriptionScalableMatrixWithTieredPricingPrice value + ) => new PriceVariants::NewSubscriptionScalableMatrixWithTieredPricingPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionCumulativeGroupedBulkPrice value) => + new PriceVariants::NewSubscriptionCumulativeGroupedBulkPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMaxGroupTieredPackagePrice value) => + new PriceVariants::NewSubscriptionMaxGroupTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedWithMeteredMinimumPrice value) => + new PriceVariants::NewSubscriptionGroupedWithMeteredMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithDisplayNamePrice value) => + new PriceVariants::NewSubscriptionMatrixWithDisplayNamePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPackagePrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPackagePriceVariant(value); + + public static implicit operator Price1(NewSubscriptionMatrixWithAllocationPrice value) => + new PriceVariants::NewSubscriptionMatrixWithAllocationPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionTieredPackageWithMinimumPrice value) => + new PriceVariants::NewSubscriptionTieredPackageWithMinimumPriceVariant(value); + + public static implicit operator Price1(NewSubscriptionGroupedTieredPrice value) => + new PriceVariants::NewSubscriptionGroupedTieredPriceVariant(value); + + public abstract void Validate(); +} diff --git a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/PriceVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/PriceVariants/All.cs index 9bbca3da..18b4e04d 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/PriceVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionSchedulePlanChangeParamsProperties/ReplacePriceProperties/PriceVariants/All.cs @@ -1,18 +1,13 @@ -using Orb = Orb; -using ReplacePriceProperties = Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties.PriceVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionUnitPrice(Subscriptions::NewSubscriptionUnitPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionUnitPriceVariant(NewSubscriptionUnitPrice Value) + : Price1, + IVariant { - public static NewSubscriptionUnitPrice From(Subscriptions::NewSubscriptionUnitPrice value) + public static NewSubscriptionUnitPriceVariant From(NewSubscriptionUnitPrice value) { return new(value); } @@ -23,19 +18,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackagePrice, - Subscriptions::NewSubscriptionPackagePrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionPackagePrice( - Subscriptions::NewSubscriptionPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionPackagePriceVariant(NewSubscriptionPackagePrice Value) + : Price1, + IVariant { - public static NewSubscriptionPackagePrice From(Subscriptions::NewSubscriptionPackagePrice value) + public static NewSubscriptionPackagePriceVariant From(NewSubscriptionPackagePrice value) { return new(value); } @@ -46,19 +36,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixPrice, - Subscriptions::NewSubscriptionMatrixPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionMatrixPrice( - Subscriptions::NewSubscriptionMatrixPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionMatrixPriceVariant(NewSubscriptionMatrixPrice Value) + : Price1, + IVariant { - public static NewSubscriptionMatrixPrice From(Subscriptions::NewSubscriptionMatrixPrice value) + public static NewSubscriptionMatrixPriceVariant From(NewSubscriptionMatrixPrice value) { return new(value); } @@ -69,19 +54,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPrice, - Subscriptions::NewSubscriptionTieredPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredPrice( - Subscriptions::NewSubscriptionTieredPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredPriceVariant(NewSubscriptionTieredPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredPrice From(Subscriptions::NewSubscriptionTieredPrice value) + public static NewSubscriptionTieredPriceVariant From(NewSubscriptionTieredPrice value) { return new(value); } @@ -92,21 +72,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredBPSPrice, - Subscriptions::NewSubscriptionTieredBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionTieredBPSPrice( - Subscriptions::NewSubscriptionTieredBPSPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionTieredBPSPriceVariant(NewSubscriptionTieredBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionTieredBPSPrice From( - Subscriptions::NewSubscriptionTieredBPSPrice value - ) + public static NewSubscriptionTieredBPSPriceVariant From(NewSubscriptionTieredBPSPrice value) { return new(value); } @@ -117,14 +90,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBPSPrice(Subscriptions::NewSubscriptionBPSPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBPSPriceVariant(NewSubscriptionBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBPSPrice From(Subscriptions::NewSubscriptionBPSPrice value) + public static NewSubscriptionBPSPriceVariant From(NewSubscriptionBPSPrice value) { return new(value); } @@ -135,19 +106,14 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkBPSPrice, - Subscriptions::NewSubscriptionBulkBPSPrice - >) +[JsonConverter( + typeof(VariantConverter) )] -public sealed record class NewSubscriptionBulkBPSPrice( - Subscriptions::NewSubscriptionBulkBPSPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant +public sealed record class NewSubscriptionBulkBPSPriceVariant(NewSubscriptionBulkBPSPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkBPSPrice From(Subscriptions::NewSubscriptionBulkBPSPrice value) + public static NewSubscriptionBulkBPSPriceVariant From(NewSubscriptionBulkBPSPrice value) { return new(value); } @@ -158,14 +124,12 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] -public sealed record class NewSubscriptionBulkPrice(Subscriptions::NewSubscriptionBulkPrice Value) - : ReplacePriceProperties::Price, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class NewSubscriptionBulkPriceVariant(NewSubscriptionBulkPrice Value) + : Price1, + IVariant { - public static NewSubscriptionBulkPrice From(Subscriptions::NewSubscriptionBulkPrice value) + public static NewSubscriptionBulkPriceVariant From(NewSubscriptionBulkPrice value) { return new(value); } @@ -176,23 +140,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice >) )] -public sealed record class NewSubscriptionThresholdTotalAmountPrice( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice Value +public sealed record class NewSubscriptionThresholdTotalAmountPriceVariant( + NewSubscriptionThresholdTotalAmountPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionThresholdTotalAmountPrice, - Subscriptions::NewSubscriptionThresholdTotalAmountPrice + : Price1, + IVariant< + NewSubscriptionThresholdTotalAmountPriceVariant, + NewSubscriptionThresholdTotalAmountPrice > { - public static NewSubscriptionThresholdTotalAmountPrice From( - Subscriptions::NewSubscriptionThresholdTotalAmountPrice value + public static NewSubscriptionThresholdTotalAmountPriceVariant From( + NewSubscriptionThresholdTotalAmountPrice value ) { return new(value); @@ -204,23 +168,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackagePriceVariant, + NewSubscriptionTieredPackagePrice >) )] -public sealed record class NewSubscriptionTieredPackagePrice( - Subscriptions::NewSubscriptionTieredPackagePrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackagePrice, - Subscriptions::NewSubscriptionTieredPackagePrice - > +public sealed record class NewSubscriptionTieredPackagePriceVariant( + NewSubscriptionTieredPackagePrice Value +) : Price1, IVariant { - public static NewSubscriptionTieredPackagePrice From( - Subscriptions::NewSubscriptionTieredPackagePrice value + public static NewSubscriptionTieredPackagePriceVariant From( + NewSubscriptionTieredPackagePrice value ) { return new(value); @@ -232,23 +191,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredWithMinimumPrice( - Subscriptions::NewSubscriptionTieredWithMinimumPrice Value +public sealed record class NewSubscriptionTieredWithMinimumPriceVariant( + NewSubscriptionTieredWithMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredWithMinimumPrice, - Subscriptions::NewSubscriptionTieredWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredWithMinimumPriceVariant, + NewSubscriptionTieredWithMinimumPrice > { - public static NewSubscriptionTieredWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredWithMinimumPrice value + public static NewSubscriptionTieredWithMinimumPriceVariant From( + NewSubscriptionTieredWithMinimumPrice value ) { return new(value); @@ -260,23 +219,20 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithPercentPriceVariant, + NewSubscriptionUnitWithPercentPrice >) )] -public sealed record class NewSubscriptionUnitWithPercentPrice( - Subscriptions::NewSubscriptionUnitWithPercentPrice Value +public sealed record class NewSubscriptionUnitWithPercentPriceVariant( + NewSubscriptionUnitWithPercentPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithPercentPrice, - Subscriptions::NewSubscriptionUnitWithPercentPrice - > + : Price1, + IVariant { - public static NewSubscriptionUnitWithPercentPrice From( - Subscriptions::NewSubscriptionUnitWithPercentPrice value + public static NewSubscriptionUnitWithPercentPriceVariant From( + NewSubscriptionUnitWithPercentPrice value ) { return new(value); @@ -288,23 +244,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice >) )] -public sealed record class NewSubscriptionPackageWithAllocationPrice( - Subscriptions::NewSubscriptionPackageWithAllocationPrice Value +public sealed record class NewSubscriptionPackageWithAllocationPriceVariant( + NewSubscriptionPackageWithAllocationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionPackageWithAllocationPrice, - Subscriptions::NewSubscriptionPackageWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionPackageWithAllocationPriceVariant, + NewSubscriptionPackageWithAllocationPrice > { - public static NewSubscriptionPackageWithAllocationPrice From( - Subscriptions::NewSubscriptionPackageWithAllocationPrice value + public static NewSubscriptionPackageWithAllocationPriceVariant From( + NewSubscriptionPackageWithAllocationPrice value ) { return new(value); @@ -316,23 +272,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice >) )] -public sealed record class NewSubscriptionTierWithProrationPrice( - Subscriptions::NewSubscriptionTierWithProrationPrice Value +public sealed record class NewSubscriptionTierWithProrationPriceVariant( + NewSubscriptionTierWithProrationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTierWithProrationPrice, - Subscriptions::NewSubscriptionTierWithProrationPrice + : Price1, + IVariant< + NewSubscriptionTierWithProrationPriceVariant, + NewSubscriptionTierWithProrationPrice > { - public static NewSubscriptionTierWithProrationPrice From( - Subscriptions::NewSubscriptionTierWithProrationPrice value + public static NewSubscriptionTierWithProrationPriceVariant From( + NewSubscriptionTierWithProrationPrice value ) { return new(value); @@ -344,23 +300,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice >) )] -public sealed record class NewSubscriptionUnitWithProrationPrice( - Subscriptions::NewSubscriptionUnitWithProrationPrice Value +public sealed record class NewSubscriptionUnitWithProrationPriceVariant( + NewSubscriptionUnitWithProrationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionUnitWithProrationPrice, - Subscriptions::NewSubscriptionUnitWithProrationPrice + : Price1, + IVariant< + NewSubscriptionUnitWithProrationPriceVariant, + NewSubscriptionUnitWithProrationPrice > { - public static NewSubscriptionUnitWithProrationPrice From( - Subscriptions::NewSubscriptionUnitWithProrationPrice value + public static NewSubscriptionUnitWithProrationPriceVariant From( + NewSubscriptionUnitWithProrationPrice value ) { return new(value); @@ -372,23 +328,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice >) )] -public sealed record class NewSubscriptionGroupedAllocationPrice( - Subscriptions::NewSubscriptionGroupedAllocationPrice Value +public sealed record class NewSubscriptionGroupedAllocationPriceVariant( + NewSubscriptionGroupedAllocationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedAllocationPrice, - Subscriptions::NewSubscriptionGroupedAllocationPrice + : Price1, + IVariant< + NewSubscriptionGroupedAllocationPriceVariant, + NewSubscriptionGroupedAllocationPrice > { - public static NewSubscriptionGroupedAllocationPrice From( - Subscriptions::NewSubscriptionGroupedAllocationPrice value + public static NewSubscriptionGroupedAllocationPriceVariant From( + NewSubscriptionGroupedAllocationPrice value ) { return new(value); @@ -400,23 +356,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithProratedMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithProratedMinimumPriceVariant( + NewSubscriptionGroupedWithProratedMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithProratedMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithProratedMinimumPriceVariant, + NewSubscriptionGroupedWithProratedMinimumPrice > { - public static NewSubscriptionGroupedWithProratedMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithProratedMinimumPrice value + public static NewSubscriptionGroupedWithProratedMinimumPriceVariant From( + NewSubscriptionGroupedWithProratedMinimumPrice value ) { return new(value); @@ -428,23 +384,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice >) )] -public sealed record class NewSubscriptionBulkWithProrationPrice( - Subscriptions::NewSubscriptionBulkWithProrationPrice Value +public sealed record class NewSubscriptionBulkWithProrationPriceVariant( + NewSubscriptionBulkWithProrationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionBulkWithProrationPrice, - Subscriptions::NewSubscriptionBulkWithProrationPrice + : Price1, + IVariant< + NewSubscriptionBulkWithProrationPriceVariant, + NewSubscriptionBulkWithProrationPrice > { - public static NewSubscriptionBulkWithProrationPrice From( - Subscriptions::NewSubscriptionBulkWithProrationPrice value + public static NewSubscriptionBulkWithProrationPriceVariant From( + NewSubscriptionBulkWithProrationPrice value ) { return new(value); @@ -456,23 +412,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithUnitPricingPriceVariant( + NewSubscriptionScalableMatrixWithUnitPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithUnitPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithUnitPricingPriceVariant, + NewSubscriptionScalableMatrixWithUnitPricingPrice > { - public static NewSubscriptionScalableMatrixWithUnitPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithUnitPricingPrice value + public static NewSubscriptionScalableMatrixWithUnitPricingPriceVariant From( + NewSubscriptionScalableMatrixWithUnitPricingPrice value ) { return new(value); @@ -484,23 +440,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice >) )] -public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPrice( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice Value +public sealed record class NewSubscriptionScalableMatrixWithTieredPricingPriceVariant( + NewSubscriptionScalableMatrixWithTieredPricingPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionScalableMatrixWithTieredPricingPrice, - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice + : Price1, + IVariant< + NewSubscriptionScalableMatrixWithTieredPricingPriceVariant, + NewSubscriptionScalableMatrixWithTieredPricingPrice > { - public static NewSubscriptionScalableMatrixWithTieredPricingPrice From( - Subscriptions::NewSubscriptionScalableMatrixWithTieredPricingPrice value + public static NewSubscriptionScalableMatrixWithTieredPricingPriceVariant From( + NewSubscriptionScalableMatrixWithTieredPricingPrice value ) { return new(value); @@ -512,23 +468,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice >) )] -public sealed record class NewSubscriptionCumulativeGroupedBulkPrice( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice Value +public sealed record class NewSubscriptionCumulativeGroupedBulkPriceVariant( + NewSubscriptionCumulativeGroupedBulkPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionCumulativeGroupedBulkPrice, - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice + : Price1, + IVariant< + NewSubscriptionCumulativeGroupedBulkPriceVariant, + NewSubscriptionCumulativeGroupedBulkPrice > { - public static NewSubscriptionCumulativeGroupedBulkPrice From( - Subscriptions::NewSubscriptionCumulativeGroupedBulkPrice value + public static NewSubscriptionCumulativeGroupedBulkPriceVariant From( + NewSubscriptionCumulativeGroupedBulkPrice value ) { return new(value); @@ -540,23 +496,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice >) )] -public sealed record class NewSubscriptionMaxGroupTieredPackagePrice( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice Value +public sealed record class NewSubscriptionMaxGroupTieredPackagePriceVariant( + NewSubscriptionMaxGroupTieredPackagePrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionMaxGroupTieredPackagePrice, - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionMaxGroupTieredPackagePriceVariant, + NewSubscriptionMaxGroupTieredPackagePrice > { - public static NewSubscriptionMaxGroupTieredPackagePrice From( - Subscriptions::NewSubscriptionMaxGroupTieredPackagePrice value + public static NewSubscriptionMaxGroupTieredPackagePriceVariant From( + NewSubscriptionMaxGroupTieredPackagePrice value ) { return new(value); @@ -568,23 +524,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice >) )] -public sealed record class NewSubscriptionGroupedWithMeteredMinimumPrice( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice Value +public sealed record class NewSubscriptionGroupedWithMeteredMinimumPriceVariant( + NewSubscriptionGroupedWithMeteredMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedWithMeteredMinimumPrice, - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice + : Price1, + IVariant< + NewSubscriptionGroupedWithMeteredMinimumPriceVariant, + NewSubscriptionGroupedWithMeteredMinimumPrice > { - public static NewSubscriptionGroupedWithMeteredMinimumPrice From( - Subscriptions::NewSubscriptionGroupedWithMeteredMinimumPrice value + public static NewSubscriptionGroupedWithMeteredMinimumPriceVariant From( + NewSubscriptionGroupedWithMeteredMinimumPrice value ) { return new(value); @@ -596,23 +552,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice >) )] -public sealed record class NewSubscriptionMatrixWithDisplayNamePrice( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice Value +public sealed record class NewSubscriptionMatrixWithDisplayNamePriceVariant( + NewSubscriptionMatrixWithDisplayNamePrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithDisplayNamePrice, - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice + : Price1, + IVariant< + NewSubscriptionMatrixWithDisplayNamePriceVariant, + NewSubscriptionMatrixWithDisplayNamePrice > { - public static NewSubscriptionMatrixWithDisplayNamePrice From( - Subscriptions::NewSubscriptionMatrixWithDisplayNamePrice value + public static NewSubscriptionMatrixWithDisplayNamePriceVariant From( + NewSubscriptionMatrixWithDisplayNamePrice value ) { return new(value); @@ -624,23 +580,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice >) )] -public sealed record class NewSubscriptionGroupedTieredPackagePrice( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice Value +public sealed record class NewSubscriptionGroupedTieredPackagePriceVariant( + NewSubscriptionGroupedTieredPackagePrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPackagePrice, - Subscriptions::NewSubscriptionGroupedTieredPackagePrice + : Price1, + IVariant< + NewSubscriptionGroupedTieredPackagePriceVariant, + NewSubscriptionGroupedTieredPackagePrice > { - public static NewSubscriptionGroupedTieredPackagePrice From( - Subscriptions::NewSubscriptionGroupedTieredPackagePrice value + public static NewSubscriptionGroupedTieredPackagePriceVariant From( + NewSubscriptionGroupedTieredPackagePrice value ) { return new(value); @@ -652,23 +608,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice >) )] -public sealed record class NewSubscriptionMatrixWithAllocationPrice( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice Value +public sealed record class NewSubscriptionMatrixWithAllocationPriceVariant( + NewSubscriptionMatrixWithAllocationPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionMatrixWithAllocationPrice, - Subscriptions::NewSubscriptionMatrixWithAllocationPrice + : Price1, + IVariant< + NewSubscriptionMatrixWithAllocationPriceVariant, + NewSubscriptionMatrixWithAllocationPrice > { - public static NewSubscriptionMatrixWithAllocationPrice From( - Subscriptions::NewSubscriptionMatrixWithAllocationPrice value + public static NewSubscriptionMatrixWithAllocationPriceVariant From( + NewSubscriptionMatrixWithAllocationPrice value ) { return new(value); @@ -680,23 +636,23 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice >) )] -public sealed record class NewSubscriptionTieredPackageWithMinimumPrice( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice Value +public sealed record class NewSubscriptionTieredPackageWithMinimumPriceVariant( + NewSubscriptionTieredPackageWithMinimumPrice Value ) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionTieredPackageWithMinimumPrice, - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice + : Price1, + IVariant< + NewSubscriptionTieredPackageWithMinimumPriceVariant, + NewSubscriptionTieredPackageWithMinimumPrice > { - public static NewSubscriptionTieredPackageWithMinimumPrice From( - Subscriptions::NewSubscriptionTieredPackageWithMinimumPrice value + public static NewSubscriptionTieredPackageWithMinimumPriceVariant From( + NewSubscriptionTieredPackageWithMinimumPrice value ) { return new(value); @@ -708,23 +664,18 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice +[JsonConverter( + typeof(VariantConverter< + NewSubscriptionGroupedTieredPriceVariant, + NewSubscriptionGroupedTieredPrice >) )] -public sealed record class NewSubscriptionGroupedTieredPrice( - Subscriptions::NewSubscriptionGroupedTieredPrice Value -) - : ReplacePriceProperties::Price, - Orb::IVariant< - NewSubscriptionGroupedTieredPrice, - Subscriptions::NewSubscriptionGroupedTieredPrice - > +public sealed record class NewSubscriptionGroupedTieredPriceVariant( + NewSubscriptionGroupedTieredPrice Value +) : Price1, IVariant { - public static NewSubscriptionGroupedTieredPrice From( - Subscriptions::NewSubscriptionGroupedTieredPrice value + public static NewSubscriptionGroupedTieredPriceVariant From( + NewSubscriptionGroupedTieredPrice value ) { return new(value); diff --git a/src/Orb/Models/Subscriptions/SubscriptionTriggerPhaseParams.cs b/src/Orb/Models/Subscriptions/SubscriptionTriggerPhaseParams.cs index b4e23106..cda9a38c 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionTriggerPhaseParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionTriggerPhaseParams.cs @@ -1,18 +1,17 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; /// /// Manually trigger a phase, effective the given date (or the current time, if not specified). /// -public sealed record class SubscriptionTriggerPhaseParams : Orb::ParamsBase +public sealed record class SubscriptionTriggerPhaseParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -28,17 +27,18 @@ public bool? AllowInvoiceCreditOrVoid if ( !this.BodyProperties.TryGetValue( "allow_invoice_credit_or_void", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["allow_invoice_credit_or_void"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["allow_invoice_credit_or_void"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -50,18 +50,15 @@ public bool? AllowInvoiceCreditOrVoid { get { - if (!this.BodyProperties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("effective_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["effective_date"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -72,21 +69,21 @@ public bool? AllowInvoiceCreditOrVoid }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUnscheduleCancellationParams.cs b/src/Orb/Models/Subscriptions/SubscriptionUnscheduleCancellationParams.cs index 11120afc..b328a28c 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUnscheduleCancellationParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUnscheduleCancellationParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Subscriptions; @@ -11,11 +10,11 @@ namespace Orb.Models.Subscriptions; /// This operation will turn on auto-renew, ensuring that the subscription does not /// end at the currently scheduled cancellation time. /// -public sealed record class SubscriptionUnscheduleCancellationParams : Orb::ParamsBase +public sealed record class SubscriptionUnscheduleCancellationParams : ParamsBase { public required string SubscriptionID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -26,12 +25,12 @@ public sealed record class SubscriptionUnscheduleCancellationParams : Orb::Param }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.cs b/src/Orb/Models/Subscriptions/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.cs index da2c8ccb..971d51a9 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -13,9 +12,9 @@ namespace Orb.Models.Subscriptions; /// If there are no updates scheduled, a request validation error will be returned /// with a 400 status code. /// -public sealed record class SubscriptionUnscheduleFixedFeeQuantityUpdatesParams : Orb::ParamsBase +public sealed record class SubscriptionUnscheduleFixedFeeQuantityUpdatesParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -26,19 +25,19 @@ public required string PriceID { get { - if (!this.BodyProperties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("price_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price_id"); } - set { this.BodyProperties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["price_id"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -52,21 +51,21 @@ public required string PriceID }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUnschedulePendingPlanChangesParams.cs b/src/Orb/Models/Subscriptions/SubscriptionUnschedulePendingPlanChangesParams.cs index 19693776..f2a2f7a5 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUnschedulePendingPlanChangesParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUnschedulePendingPlanChangesParams.cs @@ -1,5 +1,4 @@ -using Http = System.Net.Http; -using Orb = Orb; +using System.Net.Http; using System = System; namespace Orb.Models.Subscriptions; @@ -8,11 +7,11 @@ namespace Orb.Models.Subscriptions; /// This endpoint can be used to unschedule any pending plan changes on an existing /// subscription. When called, all upcoming plan changes will be unscheduled. /// -public sealed record class SubscriptionUnschedulePendingPlanChangesParams : Orb::ParamsBase +public sealed record class SubscriptionUnschedulePendingPlanChangesParams : ParamsBase { public required string SubscriptionID; - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -26,12 +25,12 @@ public sealed record class SubscriptionUnschedulePendingPlanChangesParams : Orb: }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParams.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParams.cs index 8d6660ce..59f020fa 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using SubscriptionUpdateFixedFeeQuantityParamsProperties = Orb.Models.Subscriptions.SubscriptionUpdateFixedFeeQuantityParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -22,9 +21,9 @@ namespace Orb.Models.Subscriptions; /// If the fee is an in-advance fixed fee, it will also issue an immediate invoice /// for the difference for the remainder of the billing period. /// -public sealed record class SubscriptionUpdateFixedFeeQuantityParams : Orb::ParamsBase +public sealed record class SubscriptionUpdateFixedFeeQuantityParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -35,31 +34,31 @@ public required string PriceID { get { - if (!this.BodyProperties.TryGetValue("price_id", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("price_id", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "price_id", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("price_id"); } - set { this.BodyProperties["price_id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["price_id"] = JsonSerializer.SerializeToElement(value); } } public required double Quantity { get { - if (!this.BodyProperties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["quantity"] = JsonSerializer.SerializeToElement(value); } } /// @@ -74,17 +73,18 @@ public bool? AllowInvoiceCreditOrVoid if ( !this.BodyProperties.TryGetValue( "allow_invoice_credit_or_void", - out Json::JsonElement element + out JsonElement element ) ) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["allow_invoice_credit_or_void"] = - Json::JsonSerializer.SerializeToElement(value); + this.BodyProperties["allow_invoice_credit_or_void"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -97,17 +97,14 @@ public bool? AllowInvoiceCreditOrVoid { get { - if (!this.BodyProperties.TryGetValue("change_option", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("change_option", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ); } - set - { - this.BodyProperties["change_option"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["change_option"] = JsonSerializer.SerializeToElement(value); } } /// @@ -119,18 +116,15 @@ public bool? AllowInvoiceCreditOrVoid { get { - if (!this.BodyProperties.TryGetValue("effective_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("effective_date", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["effective_date"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["effective_date"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -141,21 +135,21 @@ public bool? AllowInvoiceCreditOrVoid }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParamsProperties/ChangeOption.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParamsProperties/ChangeOption.cs index 431e3fbc..b1bcfc1f 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParamsProperties/ChangeOption.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateFixedFeeQuantityParamsProperties/ChangeOption.cs @@ -1,6 +1,5 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUpdateFixedFeeQuantityParamsProperties; @@ -9,8 +8,8 @@ namespace Orb.Models.Subscriptions.SubscriptionUpdateFixedFeeQuantityParamsPrope /// this defaults to `effective_date`. Otherwise, this defaults to `immediate` unless /// it's explicitly set to `upcoming_invoice`. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ChangeOption(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ChangeOption(string value) : IEnum { public static readonly ChangeOption Immediate = new("immediate"); @@ -33,7 +32,7 @@ public Value Known() => "immediate" => Value.Immediate, "upcoming_invoice" => Value.UpcomingInvoice, "effective_date" => Value.EffectiveDate, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateParams.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateParams.cs index 936279c1..16f52fc4 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateParams.cs @@ -1,9 +1,8 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -11,9 +10,9 @@ namespace Orb.Models.Subscriptions; /// This endpoint can be used to update the `metadata`, `net terms`, `auto_collection`, /// `invoicing_threshold`, and `default_invoice_memo` properties on a subscription. /// -public sealed record class SubscriptionUpdateParams : Orb::ParamsBase +public sealed record class SubscriptionUpdateParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -26,15 +25,12 @@ public bool? AutoCollection { get { - if (!this.BodyProperties.TryGetValue("auto_collection", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("auto_collection", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.BodyProperties["auto_collection"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.BodyProperties["auto_collection"] = JsonSerializer.SerializeToElement(value); } } /// @@ -45,21 +41,14 @@ public string? DefaultInvoiceMemo { get { - if ( - !this.BodyProperties.TryGetValue( - "default_invoice_memo", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("default_invoice_memo", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["default_invoice_memo"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["default_invoice_memo"] = JsonSerializer.SerializeToElement(value); } } @@ -72,21 +61,14 @@ public string? InvoicingThreshold { get { - if ( - !this.BodyProperties.TryGetValue( - "invoicing_threshold", - out Json::JsonElement element - ) - ) + if (!this.BodyProperties.TryGetValue("invoicing_threshold", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.BodyProperties["invoicing_threshold"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.BodyProperties["invoicing_threshold"] = JsonSerializer.SerializeToElement(value); } } @@ -95,16 +77,16 @@ public string? InvoicingThreshold /// by setting the value to `null`, and the entire metadata mapping can be cleared /// by setting `metadata` to `null`. /// - public Generic::Dictionary? Metadata + public Dictionary? Metadata { get { - if (!this.BodyProperties.TryGetValue("metadata", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.BodyProperties["metadata"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["metadata"] = JsonSerializer.SerializeToElement(value); } } /// @@ -117,15 +99,15 @@ public long? NetTerms { get { - if (!this.BodyProperties.TryGetValue("net_terms", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("net_terms", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["net_terms"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["net_terms"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -136,21 +118,21 @@ public long? NetTerms }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParams.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParams.cs index e19d50cb..a3bbba32 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParams.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParams.cs @@ -1,10 +1,9 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Text.Json; using SubscriptionUpdateTrialParamsProperties = Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties; using System = System; -using Text = System.Text; namespace Orb.Models.Subscriptions; @@ -26,9 +25,9 @@ namespace Orb.Models.Subscriptions; /// (so, e.g., if a plan change is scheduled or an add-on price was added, that change /// will be pushed back by the same amount of time the trial is extended). /// -public sealed record class SubscriptionUpdateTrialParams : Orb::ParamsBase +public sealed record class SubscriptionUpdateTrialParams : ParamsBase { - public Generic::Dictionary BodyProperties { get; set; } = []; + public Dictionary BodyProperties { get; set; } = []; public required string SubscriptionID; @@ -40,20 +39,17 @@ public sealed record class SubscriptionUpdateTrialParams : Orb::ParamsBase { get { - if (!this.BodyProperties.TryGetValue("trial_end_date", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("trial_end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "trial_end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("trial_end_date"); } - set - { - this.BodyProperties["trial_end_date"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.BodyProperties["trial_end_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -64,15 +60,15 @@ public bool? Shift { get { - if (!this.BodyProperties.TryGetValue("shift", out Json::JsonElement element)) + if (!this.BodyProperties.TryGetValue("shift", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.BodyProperties["shift"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.BodyProperties["shift"] = JsonSerializer.SerializeToElement(value); } } - public override System::Uri Url(Orb::IOrbClient client) + public override System::Uri Url(IOrbClient client) { return new System::UriBuilder( client.BaseUrl.ToString().TrimEnd('/') @@ -83,21 +79,21 @@ public bool? Shift }.Uri; } - public Http::StringContent BodyContent() + public StringContent BodyContent() { - return new Http::StringContent( - Json::JsonSerializer.Serialize(this.BodyProperties), - Text::Encoding.UTF8, + return new( + JsonSerializer.Serialize(this.BodyProperties), + Encoding.UTF8, "application/json" ); } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDate.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDate.cs index f2a3d26a..9206b076 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDate.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDate.cs @@ -1,5 +1,4 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; using TrialEndDateProperties = Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties.TrialEndDateProperties; using TrialEndDateVariants = Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties.TrialEndDateVariants; @@ -10,16 +9,16 @@ namespace Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties; /// The new date that the trial should end, or the literal string `immediate` to end /// the trial immediately. /// -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class TrialEndDate { internal TrialEndDate() { } - public static TrialEndDateVariants::UnionMember0 Create(System::DateTime value) => new(value); + public static implicit operator TrialEndDate(System::DateTime value) => + new TrialEndDateVariants::DateTime(value); - public static TrialEndDateVariants::UnionMember1 Create( - TrialEndDateProperties::UnionMember1 value - ) => new(value); + public static implicit operator TrialEndDate(TrialEndDateProperties::UnionMember1 value) => + new TrialEndDateVariants::UnionMember1(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateProperties/UnionMember1.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateProperties/UnionMember1.cs index 65de54b9..9e5f2db5 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateProperties/UnionMember1.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateProperties/UnionMember1.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties.TrialEndDateProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class UnionMember1(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class UnionMember1(string value) : IEnum { public static readonly UnionMember1 Immediate = new("immediate"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "immediate" => Value.Immediate, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateVariants/All.cs index 0dd0c8f0..9c780b37 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUpdateTrialParamsProperties/TrialEndDateVariants/All.cs @@ -1,17 +1,15 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using SubscriptionUpdateTrialParamsProperties = Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties; +using System.Text.Json.Serialization; using System = System; using TrialEndDateProperties = Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties.TrialEndDateProperties; namespace Orb.Models.Subscriptions.SubscriptionUpdateTrialParamsProperties.TrialEndDateVariants; -[Serialization::JsonConverter(typeof(Orb::VariantConverter))] -public sealed record class UnionMember0(System::DateTime Value) - : SubscriptionUpdateTrialParamsProperties::TrialEndDate, - Orb::IVariant +[JsonConverter(typeof(VariantConverter))] +public sealed record class DateTime(System::DateTime Value) + : TrialEndDate, + IVariant { - public static UnionMember0 From(System::DateTime value) + public static DateTime From(System::DateTime value) { return new(value); } @@ -19,12 +17,10 @@ public static UnionMember0 From(System::DateTime value) public override void Validate() { } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter) -)] +[JsonConverter(typeof(VariantConverter))] public sealed record class UnionMember1(TrialEndDateProperties::UnionMember1 Value) - : SubscriptionUpdateTrialParamsProperties::TrialEndDate, - Orb::IVariant + : TrialEndDate, + IVariant { public static UnionMember1 From(TrialEndDateProperties::UnionMember1 value) { diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsage.cs b/src/Orb/Models/Subscriptions/SubscriptionUsage.cs index 737f0876..30a8a777 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsage.cs @@ -1,22 +1,21 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using SubscriptionUsageProperties = Orb.Models.Subscriptions.SubscriptionUsageProperties; using SubscriptionUsageVariants = Orb.Models.Subscriptions.SubscriptionUsageVariants; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::UnionConverter))] +[JsonConverter(typeof(UnionConverter))] public abstract record class SubscriptionUsage { internal SubscriptionUsage() { } - public static SubscriptionUsageVariants::UngroupedSubscriptionUsage Create( + public static implicit operator SubscriptionUsage( SubscriptionUsageProperties::UngroupedSubscriptionUsage value - ) => new(value); + ) => new SubscriptionUsageVariants::UngroupedSubscriptionUsage(value); - public static SubscriptionUsageVariants::GroupedSubscriptionUsage Create( + public static implicit operator SubscriptionUsage( SubscriptionUsageProperties::GroupedSubscriptionUsage value - ) => new(value); + ) => new SubscriptionUsageVariants::GroupedSubscriptionUsage(value); public abstract void Validate(); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsage.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsage.cs index 97e794b0..4a376c0e 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsage.cs @@ -1,46 +1,40 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using GroupedSubscriptionUsageProperties = Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties; -using Json = System.Text.Json; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class GroupedSubscriptionUsage - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class GroupedSubscriptionUsage : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element - ) ?? throw new System::ArgumentNullException("data"); + ) ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public Models::PaginationMetadata? PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -55,15 +49,15 @@ public override void Validate() public GroupedSubscriptionUsage() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - GroupedSubscriptionUsage(Generic::Dictionary properties) + [SetsRequiredMembers] + GroupedSubscriptionUsage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static GroupedSubscriptionUsage FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/Data.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/Data.cs index 4e8d1f06..5bcbc637 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/Data.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/Data.cs @@ -1,75 +1,68 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required DataProperties::BillableMetric BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billable_metric"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billable_metric"); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::MetricGroup MetricGroup { get { - if (!this.Properties.TryGetValue("metric_group", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "metric_group", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("metric_group", out JsonElement element)) + throw new ArgumentOutOfRangeException("metric_group", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("metric_group"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("metric_group"); } - set { this.Properties["metric_group"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["metric_group"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List Usage + public required List Usage { get { - if (!this.Properties.TryGetValue("usage", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("usage", "Missing required argument"); + if (!this.Properties.TryGetValue("usage", out JsonElement element)) + throw new ArgumentOutOfRangeException("usage", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("usage"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("usage"); } - set { this.Properties["usage"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::ViewMode ViewMode { get { - if (!this.Properties.TryGetValue("view_mode", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "view_mode", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("view_mode", out JsonElement element)) + throw new ArgumentOutOfRangeException("view_mode", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("view_mode"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("view_mode"); } - set { this.Properties["view_mode"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["view_mode"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -86,14 +79,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs index 732fd8ac..9a2ed31a 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs @@ -1,39 +1,38 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BillableMetric : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BillableMetric : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -45,16 +44,14 @@ public override void Validate() public BillableMetric() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BillableMetric(Generic::Dictionary properties) + [SetsRequiredMembers] + BillableMetric(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BillableMetric FromRawUnchecked( - Generic::Dictionary properties - ) + public static BillableMetric FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/MetricGroup.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/MetricGroup.cs index fa156b71..7eff241a 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/MetricGroup.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/MetricGroup.cs @@ -1,45 +1,41 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class MetricGroup : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class MetricGroup : ModelBase, IFromRaw { public required string PropertyKey { get { - if (!this.Properties.TryGetValue("property_key", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "property_key", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("property_key", out JsonElement element)) + throw new ArgumentOutOfRangeException("property_key", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("property_key"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("property_key"); } - set { this.Properties["property_key"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["property_key"] = JsonSerializer.SerializeToElement(value); } } public required string PropertyValue { get { - if (!this.Properties.TryGetValue("property_value", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("property_value", out JsonElement element)) + throw new ArgumentOutOfRangeException( "property_value", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("property_value"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("property_value"); } - set { this.Properties["property_value"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["property_value"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -51,16 +47,14 @@ public override void Validate() public MetricGroup() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - MetricGroup(Generic::Dictionary properties) + [SetsRequiredMembers] + MetricGroup(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static MetricGroup FromRawUnchecked( - Generic::Dictionary properties - ) + public static MetricGroup FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/Usage.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/Usage.cs index ac679378..359c9401 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/Usage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/Usage.cs @@ -1,58 +1,51 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Usage : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Usage : ModelBase, IFromRaw { public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "quantity", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException("quantity", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -65,14 +58,14 @@ public override void Validate() public Usage() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Usage(Generic::Dictionary properties) + [SetsRequiredMembers] + Usage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Usage FromRawUnchecked(Generic::Dictionary properties) + public static Usage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs index e4ad985c..a45bf10b 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/GroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.GroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ViewMode(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ViewMode(string value) : IEnum { public static readonly ViewMode Periodic = new("periodic"); @@ -24,7 +23,7 @@ public Value Known() => { "periodic" => Value.Periodic, "cumulative" => Value.Cumulative, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsage.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsage.cs index 326c4d6d..4e84a522 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsage.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using UngroupedSubscriptionUsageProperties = Orb.Models.Subscriptions.SubscriptionUsageProperties.UngroupedSubscriptionUsageProperties; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class UngroupedSubscriptionUsage - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); + if (!this.Properties.TryGetValue("data", out JsonElement element)) + throw new ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>( + return JsonSerializer.Deserialize>( element - ) ?? throw new System::ArgumentNullException("data"); + ) ?? throw new ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -38,15 +37,15 @@ public override void Validate() public UngroupedSubscriptionUsage() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UngroupedSubscriptionUsage(Generic::Dictionary properties) + [SetsRequiredMembers] + UngroupedSubscriptionUsage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static UngroupedSubscriptionUsage FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/Data.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/Data.cs index c44b1249..2fbf9ea4 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/Data.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/Data.cs @@ -1,59 +1,55 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using DataProperties = Orb.Models.Subscriptions.SubscriptionUsageProperties.UngroupedSubscriptionUsageProperties.DataProperties; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.UngroupedSubscriptionUsageProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Data : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Data : ModelBase, IFromRaw { public required DataProperties::BillableMetric BillableMetric { get { - if (!this.Properties.TryGetValue("billable_metric", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("billable_metric", out JsonElement element)) + throw new ArgumentOutOfRangeException( "billable_metric", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("billable_metric"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("billable_metric"); } - set { this.Properties["billable_metric"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["billable_metric"] = JsonSerializer.SerializeToElement(value); } } - public required Generic::List Usage + public required List Usage { get { - if (!this.Properties.TryGetValue("usage", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("usage", "Missing required argument"); + if (!this.Properties.TryGetValue("usage", out JsonElement element)) + throw new ArgumentOutOfRangeException("usage", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) - ?? throw new System::ArgumentNullException("usage"); + return JsonSerializer.Deserialize>(element) + ?? throw new ArgumentNullException("usage"); } - set { this.Properties["usage"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage"] = JsonSerializer.SerializeToElement(value); } } public required DataProperties::ViewMode ViewMode { get { - if (!this.Properties.TryGetValue("view_mode", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "view_mode", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("view_mode", out JsonElement element)) + throw new ArgumentOutOfRangeException("view_mode", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("view_mode"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("view_mode"); } - set { this.Properties["view_mode"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["view_mode"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -69,14 +65,14 @@ public override void Validate() public Data() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Data(Generic::Dictionary properties) + [SetsRequiredMembers] + Data(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Data FromRawUnchecked(Generic::Dictionary properties) + public static Data FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs index 1cab95a5..c8831cf0 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/BillableMetric.cs @@ -1,39 +1,38 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.UngroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class BillableMetric : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class BillableMetric : ModelBase, IFromRaw { public required string ID { get { - if (!this.Properties.TryGetValue("id", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("id", "Missing required argument"); + if (!this.Properties.TryGetValue("id", out JsonElement element)) + throw new ArgumentOutOfRangeException("id", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("id"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("id"); } - set { this.Properties["id"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); + if (!this.Properties.TryGetValue("name", out JsonElement element)) + throw new ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("name"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -45,16 +44,14 @@ public override void Validate() public BillableMetric() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - BillableMetric(Generic::Dictionary properties) + [SetsRequiredMembers] + BillableMetric(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static BillableMetric FromRawUnchecked( - Generic::Dictionary properties - ) + public static BillableMetric FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/Usage.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/Usage.cs index a0678a5b..9f991059 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/Usage.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/Usage.cs @@ -1,58 +1,51 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.UngroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Usage : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Usage : ModelBase, IFromRaw { public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "quantity", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) + throw new ArgumentOutOfRangeException("quantity", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeEnd + public required DateTime TimeframeEnd { get { - if (!this.Properties.TryGetValue("timeframe_end", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "timeframe_end", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("timeframe_end", out JsonElement element)) + throw new ArgumentOutOfRangeException("timeframe_end", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_end"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); } } - public required System::DateTime TimeframeStart + public required DateTime TimeframeStart { get { - if (!this.Properties.TryGetValue("timeframe_start", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( + if (!this.Properties.TryGetValue("timeframe_start", out JsonElement element)) + throw new ArgumentOutOfRangeException( "timeframe_start", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["timeframe_start"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -65,14 +58,14 @@ public override void Validate() public Usage() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Usage(Generic::Dictionary properties) + [SetsRequiredMembers] + Usage(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Usage FromRawUnchecked(Generic::Dictionary properties) + public static Usage FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs index 83f67c13..2de809cc 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageProperties/UngroupedSubscriptionUsageProperties/DataProperties/ViewMode.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.Subscriptions.SubscriptionUsageProperties.UngroupedSubscriptionUsageProperties.DataProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ViewMode(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ViewMode(string value) : IEnum { public static readonly ViewMode Periodic = new("periodic"); @@ -24,7 +23,7 @@ public Value Known() => { "periodic" => Value.Periodic, "cumulative" => Value.Cumulative, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/Subscriptions/SubscriptionUsageVariants/All.cs b/src/Orb/Models/Subscriptions/SubscriptionUsageVariants/All.cs index f8c6a607..62512676 100644 --- a/src/Orb/Models/Subscriptions/SubscriptionUsageVariants/All.cs +++ b/src/Orb/Models/Subscriptions/SubscriptionUsageVariants/All.cs @@ -1,12 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using Subscriptions = Orb.Models.Subscriptions; +using System.Text.Json.Serialization; using SubscriptionUsageProperties = Orb.Models.Subscriptions.SubscriptionUsageProperties; namespace Orb.Models.Subscriptions.SubscriptionUsageVariants; -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< +[JsonConverter( + typeof(VariantConverter< UngroupedSubscriptionUsage, SubscriptionUsageProperties::UngroupedSubscriptionUsage >) @@ -14,8 +12,8 @@ namespace Orb.Models.Subscriptions.SubscriptionUsageVariants; public sealed record class UngroupedSubscriptionUsage( SubscriptionUsageProperties::UngroupedSubscriptionUsage Value ) - : Subscriptions::SubscriptionUsage, - Orb::IVariant< + : SubscriptionUsage, + IVariant< UngroupedSubscriptionUsage, SubscriptionUsageProperties::UngroupedSubscriptionUsage > @@ -33,8 +31,8 @@ public override void Validate() } } -[Serialization::JsonConverter( - typeof(Orb::VariantConverter< +[JsonConverter( + typeof(VariantConverter< GroupedSubscriptionUsage, SubscriptionUsageProperties::GroupedSubscriptionUsage >) @@ -42,11 +40,8 @@ public override void Validate() public sealed record class GroupedSubscriptionUsage( SubscriptionUsageProperties::GroupedSubscriptionUsage Value ) - : Subscriptions::SubscriptionUsage, - Orb::IVariant< - GroupedSubscriptionUsage, - SubscriptionUsageProperties::GroupedSubscriptionUsage - > + : SubscriptionUsage, + IVariant { public static GroupedSubscriptionUsage From( SubscriptionUsageProperties::GroupedSubscriptionUsage value diff --git a/src/Orb/Models/Subscriptions/Subscriptions.cs b/src/Orb/Models/Subscriptions/Subscriptions.cs index 8e4c87f0..035dd8de 100644 --- a/src/Orb/Models/Subscriptions/Subscriptions.cs +++ b/src/Orb/Models/Subscriptions/Subscriptions.cs @@ -1,46 +1,42 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using Models = Orb.Models; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; using System = System; namespace Orb.Models.Subscriptions; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Subscriptions : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Subscriptions : ModelBase, IFromRaw { - public required Generic::List Data + public required List Data { get { - if (!this.Properties.TryGetValue("data", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("data", out JsonElement element)) throw new System::ArgumentOutOfRangeException("data", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("data"); } - set { this.Properties["data"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["data"] = JsonSerializer.SerializeToElement(value); } } public required Models::PaginationMetadata PaginationMetadata { get { - if (!this.Properties.TryGetValue("pagination_metadata", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("pagination_metadata", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "pagination_metadata", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("pagination_metadata"); } - set - { - this.Properties["pagination_metadata"] = Json::JsonSerializer.SerializeToElement(value); - } + set { this.Properties["pagination_metadata"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -55,16 +51,14 @@ public override void Validate() public Subscriptions() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Subscriptions(Generic::Dictionary properties) + [SetsRequiredMembers] + Subscriptions(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Subscriptions FromRawUnchecked( - Generic::Dictionary properties - ) + public static Subscriptions FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TaxAmount.cs b/src/Orb/Models/TaxAmount.cs index b8b79337..e1eb1290 100644 --- a/src/Orb/Models/TaxAmount.cs +++ b/src/Orb/Models/TaxAmount.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TaxAmount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TaxAmount : ModelBase, IFromRaw { /// /// The amount of additional tax incurred by this tax rate. @@ -17,16 +16,16 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,21 +35,16 @@ public required string TaxRateDescription { get { - if (!this.Properties.TryGetValue("tax_rate_description", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_rate_description", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_rate_description", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tax_rate_description"); } - set - { - this.Properties["tax_rate_description"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["tax_rate_description"] = JsonSerializer.SerializeToElement(value); } } /// @@ -60,18 +54,15 @@ public required string? TaxRatePercentage { get { - if (!this.Properties.TryGetValue("tax_rate_percentage", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tax_rate_percentage", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tax_rate_percentage", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["tax_rate_percentage"] = Json::JsonSerializer.SerializeToElement(value); + return JsonSerializer.Deserialize(element); } + set { this.Properties["tax_rate_percentage"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -84,16 +75,14 @@ public override void Validate() public TaxAmount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TaxAmount(Generic::Dictionary properties) + [SetsRequiredMembers] + TaxAmount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TaxAmount FromRawUnchecked( - Generic::Dictionary properties - ) + public static TaxAmount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/Tier.cs b/src/Orb/Models/Tier.cs index 7ba90ece..df74c244 100644 --- a/src/Orb/Models/Tier.cs +++ b/src/Orb/Models/Tier.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class Tier : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class Tier : ModelBase, IFromRaw { /// /// Exclusive tier starting value @@ -17,15 +16,15 @@ public required double FirstUnit { get { - if (!this.Properties.TryGetValue("first_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("first_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "first_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["first_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["first_unit"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,16 +34,16 @@ public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -54,12 +53,12 @@ public double? LastUnit { get { - if (!this.Properties.TryGetValue("last_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("last_unit", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["last_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["last_unit"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -72,14 +71,14 @@ public override void Validate() public Tier() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - Tier(Generic::Dictionary properties) + [SetsRequiredMembers] + Tier(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static Tier FromRawUnchecked(Generic::Dictionary properties) + public static Tier FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TierConfig.cs b/src/Orb/Models/TierConfig.cs index 453a6eb0..1a83159e 100644 --- a/src/Orb/Models/TierConfig.cs +++ b/src/Orb/Models/TierConfig.cs @@ -1,59 +1,58 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TierConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TierConfig : ModelBase, IFromRaw { public required double FirstUnit { get { - if (!this.Properties.TryGetValue("first_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("first_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "first_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["first_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["first_unit"] = JsonSerializer.SerializeToElement(value); } } public required double? LastUnit { get { - if (!this.Properties.TryGetValue("last_unit", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("last_unit", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "last_unit", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["last_unit"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["last_unit"] = JsonSerializer.SerializeToElement(value); } } public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -66,16 +65,14 @@ public override void Validate() public TierConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TierConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + TierConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TierConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static TierConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TierSubLineItem.cs b/src/Orb/Models/TierSubLineItem.cs index 79cc7494..968032d1 100644 --- a/src/Orb/Models/TierSubLineItem.cs +++ b/src/Orb/Models/TierSubLineItem.cs @@ -1,15 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using TierSubLineItemProperties = Orb.Models.TierSubLineItemProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TierSubLineItem : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TierSubLineItem : ModelBase, IFromRaw { /// /// The total amount for this sub line item. @@ -18,88 +17,88 @@ public required string Amount { get { - if (!this.Properties.TryGetValue("amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("amount"); } - set { this.Properties["amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["amount"] = JsonSerializer.SerializeToElement(value); } } public required SubLineItemGrouping? Grouping { get { - if (!this.Properties.TryGetValue("grouping", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("grouping", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "grouping", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["grouping"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["grouping"] = JsonSerializer.SerializeToElement(value); } } public required string Name { get { - if (!this.Properties.TryGetValue("name", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("name", out JsonElement element)) throw new System::ArgumentOutOfRangeException("name", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("name"); } - set { this.Properties["name"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["name"] = JsonSerializer.SerializeToElement(value); } } public required double Quantity { get { - if (!this.Properties.TryGetValue("quantity", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("quantity", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "quantity", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["quantity"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["quantity"] = JsonSerializer.SerializeToElement(value); } } public required TierConfig TierConfig { get { - if (!this.Properties.TryGetValue("tier_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tier_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tier_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tier_config"); } - set { this.Properties["tier_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tier_config"] = JsonSerializer.SerializeToElement(value); } } public required TierSubLineItemProperties::Type Type { get { - if (!this.Properties.TryGetValue("type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("type", out JsonElement element)) throw new System::ArgumentOutOfRangeException("type", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("type"); } - set { this.Properties["type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -115,16 +114,14 @@ public override void Validate() public TierSubLineItem() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TierSubLineItem(Generic::Dictionary properties) + [SetsRequiredMembers] + TierSubLineItem(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TierSubLineItem FromRawUnchecked( - Generic::Dictionary properties - ) + public static TierSubLineItem FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TierSubLineItemProperties/Type.cs b/src/Orb/Models/TierSubLineItemProperties/Type.cs index a3ca76b9..16566a51 100644 --- a/src/Orb/Models/TierSubLineItemProperties/Type.cs +++ b/src/Orb/Models/TierSubLineItemProperties/Type.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models.TierSubLineItemProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Type(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Type(string value) : IEnum { public static readonly Type Tier = new("tier"); diff --git a/src/Orb/Models/TieredBPSConfig.cs b/src/Orb/Models/TieredBPSConfig.cs index bf6b5d0a..d9ed4306 100644 --- a/src/Orb/Models/TieredBPSConfig.cs +++ b/src/Orb/Models/TieredBPSConfig.cs @@ -1,29 +1,28 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredBPSConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredBPSConfig : ModelBase, IFromRaw { /// /// Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers /// - public required Generic::List Tiers + public required List Tiers { get { - if (!this.Properties.TryGetValue("tiers", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiers", out JsonElement element)) throw new System::ArgumentOutOfRangeException("tiers", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tiers"); } - set { this.Properties["tiers"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiers"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +36,14 @@ public override void Validate() public TieredBPSConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredBPSConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredBPSConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TieredBPSConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static TieredBPSConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TieredConfig.cs b/src/Orb/Models/TieredConfig.cs index 933a75bf..88db39ce 100644 --- a/src/Orb/Models/TieredConfig.cs +++ b/src/Orb/Models/TieredConfig.cs @@ -1,29 +1,28 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TieredConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TieredConfig : ModelBase, IFromRaw { /// /// Tiers for rating based on total usage quantities into the specified tier /// - public required Generic::List Tiers + public required List Tiers { get { - if (!this.Properties.TryGetValue("tiers", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiers", out JsonElement element)) throw new System::ArgumentOutOfRangeException("tiers", "Missing required argument"); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("tiers"); } - set { this.Properties["tiers"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiers"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +36,14 @@ public override void Validate() public TieredConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TieredConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static TieredConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TieredConversionRateConfig.cs b/src/Orb/Models/TieredConversionRateConfig.cs index 8debcb1a..b9ccff99 100644 --- a/src/Orb/Models/TieredConversionRateConfig.cs +++ b/src/Orb/Models/TieredConversionRateConfig.cs @@ -1,54 +1,48 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using TieredConversionRateConfigProperties = Orb.Models.TieredConversionRateConfigProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] +[JsonConverter(typeof(ModelConverter))] public sealed record class TieredConversionRateConfig - : Orb::ModelBase, - Orb::IFromRaw + : ModelBase, + IFromRaw { public required TieredConversionRateConfigProperties::ConversionRateType ConversionRateType { get { - if (!this.Properties.TryGetValue("conversion_rate_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "conversion_rate_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("conversion_rate_type"); } - set - { - this.Properties["conversion_rate_type"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["conversion_rate_type"] = JsonSerializer.SerializeToElement(value); } } public required ConversionRateTieredConfig TieredConfig { get { - if (!this.Properties.TryGetValue("tiered_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("tiered_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "tiered_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("tiered_config"); } - set { this.Properties["tiered_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["tiered_config"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -60,15 +54,15 @@ public override void Validate() public TieredConversionRateConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TieredConversionRateConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + TieredConversionRateConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static TieredConversionRateConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/TieredConversionRateConfigProperties/ConversionRateType.cs b/src/Orb/Models/TieredConversionRateConfigProperties/ConversionRateType.cs index 47ad31a4..c473d56c 100644 --- a/src/Orb/Models/TieredConversionRateConfigProperties/ConversionRateType.cs +++ b/src/Orb/Models/TieredConversionRateConfigProperties/ConversionRateType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.TieredConversionRateConfigProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ConversionRateType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ConversionRateType(string value) : IEnum { public static readonly ConversionRateType Tiered = new("tiered"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "tiered" => Value.Tiered, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/TopLevel/TopLevelPingParams.cs b/src/Orb/Models/TopLevel/TopLevelPingParams.cs index 2e57eabe..6422eb94 100644 --- a/src/Orb/Models/TopLevel/TopLevelPingParams.cs +++ b/src/Orb/Models/TopLevel/TopLevelPingParams.cs @@ -1,6 +1,5 @@ -using Http = System.Net.Http; -using Orb = Orb; -using System = System; +using System; +using System.Net.Http; namespace Orb.Models.TopLevel; @@ -12,22 +11,22 @@ namespace Orb.Models.TopLevel; /// /// This API does not have any side-effects or return any Orb resources. /// -public sealed record class TopLevelPingParams : Orb::ParamsBase +public sealed record class TopLevelPingParams : ParamsBase { - public override System::Uri Url(Orb::IOrbClient client) + public override Uri Url(IOrbClient client) { - return new System::UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/ping") + return new UriBuilder(client.BaseUrl.ToString().TrimEnd('/') + "/ping") { Query = this.QueryString(client), }.Uri; } - public void AddHeadersToRequest(Http::HttpRequestMessage request, Orb::IOrbClient client) + public void AddHeadersToRequest(HttpRequestMessage request, IOrbClient client) { - Orb::ParamsBase.AddDefaultHeaders(request, client); + ParamsBase.AddDefaultHeaders(request, client); foreach (var item in this.HeaderProperties) { - Orb::ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); + ParamsBase.AddHeaderElementToRequest(request, item.Key, item.Value); } } } diff --git a/src/Orb/Models/TopLevel/TopLevelPingResponse.cs b/src/Orb/Models/TopLevel/TopLevelPingResponse.cs index 4d353ccb..2d080f9f 100644 --- a/src/Orb/Models/TopLevel/TopLevelPingResponse.cs +++ b/src/Orb/Models/TopLevel/TopLevelPingResponse.cs @@ -1,31 +1,25 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Orb.Models.TopLevel; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TopLevelPingResponse - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TopLevelPingResponse : ModelBase, IFromRaw { public required string Response { get { - if (!this.Properties.TryGetValue("response", out Json::JsonElement element)) - throw new System::ArgumentOutOfRangeException( - "response", - "Missing required argument" - ); + if (!this.Properties.TryGetValue("response", out JsonElement element)) + throw new ArgumentOutOfRangeException("response", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) - ?? throw new System::ArgumentNullException("response"); + return JsonSerializer.Deserialize(element) + ?? throw new ArgumentNullException("response"); } - set { this.Properties["response"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["response"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -36,16 +30,14 @@ public override void Validate() public TopLevelPingResponse() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TopLevelPingResponse(Generic::Dictionary properties) + [SetsRequiredMembers] + TopLevelPingResponse(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TopLevelPingResponse FromRawUnchecked( - Generic::Dictionary properties - ) + public static TopLevelPingResponse FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TransformPriceFilter.cs b/src/Orb/Models/TransformPriceFilter.cs index f72da26c..e9f08dd5 100644 --- a/src/Orb/Models/TransformPriceFilter.cs +++ b/src/Orb/Models/TransformPriceFilter.cs @@ -1,17 +1,14 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using TransformPriceFilterProperties = Orb.Models.TransformPriceFilterProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TransformPriceFilter - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TransformPriceFilter : ModelBase, IFromRaw { /// /// The property of the price to filter on. @@ -20,13 +17,13 @@ public sealed record class TransformPriceFilter { get { - if (!this.Properties.TryGetValue("field", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("field", out JsonElement element)) throw new System::ArgumentOutOfRangeException("field", "Missing required argument"); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("field"); } - set { this.Properties["field"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["field"] = JsonSerializer.SerializeToElement(value); } } /// @@ -36,36 +33,35 @@ public sealed record class TransformPriceFilter { get { - if (!this.Properties.TryGetValue("operator", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("operator", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "operator", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( - element - ) ?? throw new System::ArgumentNullException("operator"); + return JsonSerializer.Deserialize(element) + ?? throw new System::ArgumentNullException("operator"); } - set { this.Properties["operator"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["operator"] = JsonSerializer.SerializeToElement(value); } } /// /// The IDs or values that match this filter. /// - public required Generic::List Values + public required List Values { get { - if (!this.Properties.TryGetValue("values", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("values", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "values", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("values"); } - set { this.Properties["values"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["values"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -81,16 +77,14 @@ public override void Validate() public TransformPriceFilter() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TransformPriceFilter(Generic::Dictionary properties) + [SetsRequiredMembers] + TransformPriceFilter(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TransformPriceFilter FromRawUnchecked( - Generic::Dictionary properties - ) + public static TransformPriceFilter FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TransformPriceFilterProperties/Field.cs b/src/Orb/Models/TransformPriceFilterProperties/Field.cs index 8db10cad..fd8896e4 100644 --- a/src/Orb/Models/TransformPriceFilterProperties/Field.cs +++ b/src/Orb/Models/TransformPriceFilterProperties/Field.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.TransformPriceFilterProperties; /// /// The property of the price to filter on. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Field(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Field(string value) : IEnum { public static readonly Field PriceID = new("price_id"); @@ -39,7 +38,7 @@ public Value Known() => "price_type" => Value.PriceType, "currency" => Value.Currency, "pricing_unit_id" => Value.PricingUnitID, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/TransformPriceFilterProperties/Operator.cs b/src/Orb/Models/TransformPriceFilterProperties/Operator.cs index 6ad9c951..5af9b771 100644 --- a/src/Orb/Models/TransformPriceFilterProperties/Operator.cs +++ b/src/Orb/Models/TransformPriceFilterProperties/Operator.cs @@ -1,14 +1,13 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.TransformPriceFilterProperties; /// /// Should prices that match the filter be included or excluded. /// -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class Operator(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class Operator(string value) : IEnum { public static readonly Operator Includes = new("includes"); @@ -27,7 +26,7 @@ public Value Known() => { "includes" => Value.Includes, "excludes" => Value.Excludes, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/TrialDiscount.cs b/src/Orb/Models/TrialDiscount.cs index a2a47684..5029c74b 100644 --- a/src/Orb/Models/TrialDiscount.cs +++ b/src/Orb/Models/TrialDiscount.cs @@ -1,78 +1,72 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using TrialDiscountProperties = Orb.Models.TrialDiscountProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class TrialDiscount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class TrialDiscount : ModelBase, IFromRaw { public required TrialDiscountProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// /// List of price_ids that this discount applies to. For plan/plan phase discounts, /// this can be a subset of prices. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this discount to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } /// @@ -82,19 +76,12 @@ public string? TrialAmountDiscount { get { - if ( - !this.Properties.TryGetValue("trial_amount_discount", out Json::JsonElement element) - ) + if (!this.Properties.TryGetValue("trial_amount_discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); - } - set - { - this.Properties["trial_amount_discount"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize(element); } + set { this.Properties["trial_amount_discount"] = JsonSerializer.SerializeToElement(value); } } /// @@ -104,21 +91,14 @@ public double? TrialPercentageDiscount { get { - if ( - !this.Properties.TryGetValue( - "trial_percentage_discount", - out Json::JsonElement element - ) - ) + if (!this.Properties.TryGetValue("trial_percentage_discount", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } set { - this.Properties["trial_percentage_discount"] = Json::JsonSerializer.SerializeToElement( - value - ); + this.Properties["trial_percentage_discount"] = JsonSerializer.SerializeToElement(value); } } @@ -141,16 +121,14 @@ public override void Validate() public TrialDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - TrialDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + TrialDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static TrialDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static TrialDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/TrialDiscountProperties/DiscountType.cs b/src/Orb/Models/TrialDiscountProperties/DiscountType.cs index 3b72a607..26fcc127 100644 --- a/src/Orb/Models/TrialDiscountProperties/DiscountType.cs +++ b/src/Orb/Models/TrialDiscountProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.TrialDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Trial = new("trial"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "trial" => Value.Trial, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/UnitConfig.cs b/src/Orb/Models/UnitConfig.cs index e60a3050..fb7b0ee9 100644 --- a/src/Orb/Models/UnitConfig.cs +++ b/src/Orb/Models/UnitConfig.cs @@ -1,14 +1,13 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class UnitConfig : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class UnitConfig : ModelBase, IFromRaw { /// /// Rate per unit of usage @@ -17,16 +16,16 @@ public required string UnitAmount { get { - if (!this.Properties.TryGetValue("unit_amount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_amount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_amount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_amount"); } - set { this.Properties["unit_amount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_amount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -37,16 +36,14 @@ public override void Validate() public UnitConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UnitConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + UnitConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static UnitConfig FromRawUnchecked( - Generic::Dictionary properties - ) + public static UnitConfig FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/UnitConversionRateConfig.cs b/src/Orb/Models/UnitConversionRateConfig.cs index 561755da..9e575ec5 100644 --- a/src/Orb/Models/UnitConversionRateConfig.cs +++ b/src/Orb/Models/UnitConversionRateConfig.cs @@ -1,54 +1,46 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using UnitConversionRateConfigProperties = Orb.Models.UnitConversionRateConfigProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class UnitConversionRateConfig - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class UnitConversionRateConfig : ModelBase, IFromRaw { public required UnitConversionRateConfigProperties::ConversionRateType ConversionRateType { get { - if (!this.Properties.TryGetValue("conversion_rate_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("conversion_rate_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "conversion_rate_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("conversion_rate_type"); } - set - { - this.Properties["conversion_rate_type"] = Json::JsonSerializer.SerializeToElement( - value - ); - } + set { this.Properties["conversion_rate_type"] = JsonSerializer.SerializeToElement(value); } } public required ConversionRateUnitConfig UnitConfig { get { - if (!this.Properties.TryGetValue("unit_config", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("unit_config", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "unit_config", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("unit_config"); } - set { this.Properties["unit_config"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["unit_config"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -60,15 +52,15 @@ public override void Validate() public UnitConversionRateConfig() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UnitConversionRateConfig(Generic::Dictionary properties) + [SetsRequiredMembers] + UnitConversionRateConfig(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 public static UnitConversionRateConfig FromRawUnchecked( - Generic::Dictionary properties + Dictionary properties ) { return new(properties); diff --git a/src/Orb/Models/UnitConversionRateConfigProperties/ConversionRateType.cs b/src/Orb/Models/UnitConversionRateConfigProperties/ConversionRateType.cs index 4b4115b8..45688415 100644 --- a/src/Orb/Models/UnitConversionRateConfigProperties/ConversionRateType.cs +++ b/src/Orb/Models/UnitConversionRateConfigProperties/ConversionRateType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.UnitConversionRateConfigProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class ConversionRateType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class ConversionRateType(string value) : IEnum { public static readonly ConversionRateType Unit = new("unit"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "unit" => Value.Unit, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/UsageDiscount.cs b/src/Orb/Models/UsageDiscount.cs index f1e7278d..3a7e5e72 100644 --- a/src/Orb/Models/UsageDiscount.cs +++ b/src/Orb/Models/UsageDiscount.cs @@ -1,30 +1,29 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using UsageDiscountProperties = Orb.Models.UsageDiscountProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class UsageDiscount : Orb::ModelBase, Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class UsageDiscount : ModelBase, IFromRaw { public required UsageDiscountProperties::DiscountType DiscountType { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element) + return JsonSerializer.Deserialize(element) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -35,63 +34,58 @@ public required double UsageDiscount1 { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } /// /// List of price_ids that this discount applies to. For plan/plan phase discounts, /// this can be a subset of prices. /// - public Generic::List? AppliesToPriceIDs + public List? AppliesToPriceIDs { get { - if (!this.Properties.TryGetValue("applies_to_price_ids", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("applies_to_price_ids", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); - } - set - { - this.Properties["applies_to_price_ids"] = Json::JsonSerializer.SerializeToElement( - value - ); + return JsonSerializer.Deserialize?>(element); } + set { this.Properties["applies_to_price_ids"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices to apply this discount to. /// - public Generic::List? Filters + public List? Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize?>(element); + return JsonSerializer.Deserialize?>(element); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } public string? Reason { get { - if (!this.Properties.TryGetValue("reason", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("reason", out JsonElement element)) return null; - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["reason"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["reason"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -112,16 +106,14 @@ public override void Validate() public UsageDiscount() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UsageDiscount(Generic::Dictionary properties) + [SetsRequiredMembers] + UsageDiscount(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static UsageDiscount FromRawUnchecked( - Generic::Dictionary properties - ) + public static UsageDiscount FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/UsageDiscountInterval.cs b/src/Orb/Models/UsageDiscountInterval.cs index 967cf9e3..638c1c6d 100644 --- a/src/Orb/Models/UsageDiscountInterval.cs +++ b/src/Orb/Models/UsageDiscountInterval.cs @@ -1,29 +1,26 @@ -using CodeAnalysis = System.Diagnostics.CodeAnalysis; -using Generic = System.Collections.Generic; -using Json = System.Text.Json; -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Text.Json.Serialization; using System = System; using UsageDiscountIntervalProperties = Orb.Models.UsageDiscountIntervalProperties; namespace Orb.Models; -[Serialization::JsonConverter(typeof(Orb::ModelConverter))] -public sealed record class UsageDiscountInterval - : Orb::ModelBase, - Orb::IFromRaw +[JsonConverter(typeof(ModelConverter))] +public sealed record class UsageDiscountInterval : ModelBase, IFromRaw { /// /// The price interval ids that this discount interval applies to. /// - public required Generic::List AppliesToPriceIntervalIDs + public required List AppliesToPriceIntervalIDs { get { if ( !this.Properties.TryGetValue( "applies_to_price_interval_ids", - out Json::JsonElement element + out JsonElement element ) ) throw new System::ArgumentOutOfRangeException( @@ -31,13 +28,14 @@ public sealed record class UsageDiscountInterval "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("applies_to_price_interval_ids"); } set { - this.Properties["applies_to_price_interval_ids"] = - Json::JsonSerializer.SerializeToElement(value); + this.Properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement( + value + ); } } @@ -45,17 +43,17 @@ public sealed record class UsageDiscountInterval { get { - if (!this.Properties.TryGetValue("discount_type", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("discount_type", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "discount_type", "Missing required argument" ); - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( element ) ?? throw new System::ArgumentNullException("discount_type"); } - set { this.Properties["discount_type"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["discount_type"] = JsonSerializer.SerializeToElement(value); } } /// @@ -65,34 +63,34 @@ public sealed record class UsageDiscountInterval { get { - if (!this.Properties.TryGetValue("end_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("end_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "end_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["end_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); } } /// /// The filters that determine which prices this discount interval applies to. /// - public required Generic::List Filters + public required List Filters { get { - if (!this.Properties.TryGetValue("filters", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("filters", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "filters", "Missing required argument" ); - return Json::JsonSerializer.Deserialize>(element) + return JsonSerializer.Deserialize>(element) ?? throw new System::ArgumentNullException("filters"); } - set { this.Properties["filters"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["filters"] = JsonSerializer.SerializeToElement(value); } } /// @@ -102,15 +100,15 @@ public sealed record class UsageDiscountInterval { get { - if (!this.Properties.TryGetValue("start_date", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("start_date", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "start_date", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["start_date"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); } } /// @@ -121,15 +119,15 @@ public required double UsageDiscount { get { - if (!this.Properties.TryGetValue("usage_discount", out Json::JsonElement element)) + if (!this.Properties.TryGetValue("usage_discount", out JsonElement element)) throw new System::ArgumentOutOfRangeException( "usage_discount", "Missing required argument" ); - return Json::JsonSerializer.Deserialize(element); + return JsonSerializer.Deserialize(element); } - set { this.Properties["usage_discount"] = Json::JsonSerializer.SerializeToElement(value); } + set { this.Properties["usage_discount"] = JsonSerializer.SerializeToElement(value); } } public override void Validate() @@ -151,16 +149,14 @@ public override void Validate() public UsageDiscountInterval() { } #pragma warning disable CS8618 - [CodeAnalysis::SetsRequiredMembers] - UsageDiscountInterval(Generic::Dictionary properties) + [SetsRequiredMembers] + UsageDiscountInterval(Dictionary properties) { Properties = properties; } #pragma warning restore CS8618 - public static UsageDiscountInterval FromRawUnchecked( - Generic::Dictionary properties - ) + public static UsageDiscountInterval FromRawUnchecked(Dictionary properties) { return new(properties); } diff --git a/src/Orb/Models/UsageDiscountIntervalProperties/DiscountType.cs b/src/Orb/Models/UsageDiscountIntervalProperties/DiscountType.cs index 89aa63db..f218fa9c 100644 --- a/src/Orb/Models/UsageDiscountIntervalProperties/DiscountType.cs +++ b/src/Orb/Models/UsageDiscountIntervalProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.UsageDiscountIntervalProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Usage = new("usage"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "usage" => Value.Usage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Models/UsageDiscountProperties/DiscountType.cs b/src/Orb/Models/UsageDiscountProperties/DiscountType.cs index 1ea79aef..8fbe1635 100644 --- a/src/Orb/Models/UsageDiscountProperties/DiscountType.cs +++ b/src/Orb/Models/UsageDiscountProperties/DiscountType.cs @@ -1,11 +1,10 @@ -using Orb = Orb; -using Serialization = System.Text.Json.Serialization; -using System = System; +using System; +using System.Text.Json.Serialization; namespace Orb.Models.UsageDiscountProperties; -[Serialization::JsonConverter(typeof(Orb::EnumConverter))] -public sealed record class DiscountType(string value) : Orb::IEnum +[JsonConverter(typeof(EnumConverter))] +public sealed record class DiscountType(string value) : IEnum { public static readonly DiscountType Usage = new("usage"); @@ -20,7 +19,7 @@ public Value Known() => _value switch { "usage" => Value.Usage, - _ => throw new System::ArgumentOutOfRangeException(nameof(_value)), + _ => throw new ArgumentOutOfRangeException(nameof(_value)), }; public string Raw() diff --git a/src/Orb/Orb.csproj b/src/Orb/Orb.csproj index 0bd11084..55cb0329 100644 --- a/src/Orb/Orb.csproj +++ b/src/Orb/Orb.csproj @@ -28,5 +28,6 @@ Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))" >true + disable diff --git a/src/Orb/OrbClient.cs b/src/Orb/OrbClient.cs index 141236d4..0f0d21b1 100644 --- a/src/Orb/OrbClient.cs +++ b/src/Orb/OrbClient.cs @@ -3,7 +3,6 @@ using Coupons = Orb.Service.Coupons; using CreditNotes = Orb.Service.CreditNotes; using Customers = Orb.Service.Customers; -using DimensionalPriceGroups = Orb.Service.DimensionalPriceGroups; using Events = Orb.Service.Events; using Http = System.Net.Http; using InvoiceLineItems = Orb.Service.InvoiceLineItems; @@ -13,7 +12,6 @@ using Plans = Orb.Service.Plans; using Prices = Orb.Service.Prices; using SubscriptionChanges = Orb.Service.SubscriptionChanges; -using Subscriptions = Orb.Service.Subscriptions; using System = System; using TopLevel = Orb.Service.TopLevel; @@ -21,7 +19,7 @@ namespace Orb; public sealed class OrbClient : IOrbClient { - public Http::HttpClient HttpClient { get; init; } = new Http::HttpClient(); + public Http::HttpClient HttpClient { get; init; } = new(); System::Lazy _baseUrl = new(() => new System::Uri( @@ -117,8 +115,8 @@ public string APIKey get { return _prices.Value; } } - readonly System::Lazy _subscriptions; - public Subscriptions::ISubscriptionService Subscriptions + readonly System::Lazy _subscriptions; + public global::Orb.Service.Subscriptions.ISubscriptionService Subscriptions { get { return _subscriptions.Value; } } @@ -129,8 +127,8 @@ public string APIKey get { return _alerts.Value; } } - readonly System::Lazy _dimensionalPriceGroups; - public DimensionalPriceGroups::IDimensionalPriceGroupService DimensionalPriceGroups + readonly System::Lazy _dimensionalPriceGroups; + public global::Orb.Service.DimensionalPriceGroups.IDimensionalPriceGroupService DimensionalPriceGroups { get { return _dimensionalPriceGroups.Value; } } @@ -155,10 +153,10 @@ public OrbClient() _metrics = new(() => new Metrics::MetricService(this)); _plans = new(() => new Plans::PlanService(this)); _prices = new(() => new Prices::PriceService(this)); - _subscriptions = new(() => new Subscriptions::SubscriptionService(this)); + _subscriptions = new(() => new global::Orb.Service.Subscriptions.SubscriptionService(this)); _alerts = new(() => new Alerts::AlertService(this)); _dimensionalPriceGroups = new(() => - new DimensionalPriceGroups::DimensionalPriceGroupService(this) + new global::Orb.Service.DimensionalPriceGroups.DimensionalPriceGroupService(this) ); _subscriptionChanges = new(() => new SubscriptionChanges::SubscriptionChangeService(this)); } diff --git a/src/Orb/ParamsBase.cs b/src/Orb/ParamsBase.cs index 60aee26f..f4b16a4e 100644 --- a/src/Orb/ParamsBase.cs +++ b/src/Orb/ParamsBase.cs @@ -1,44 +1,44 @@ -using Generic = System.Collections.Generic; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Specialized = System.Collections.Specialized; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Net.Http; +using System.Text; +using System.Text.Json; using System = System; -using Text = System.Text; using Web = System.Web; namespace Orb; public abstract record class ParamsBase { - public Generic::Dictionary QueryProperties { get; set; } = []; + public Dictionary QueryProperties { get; set; } = []; - public Generic::Dictionary HeaderProperties { get; set; } = []; + public Dictionary HeaderProperties { get; set; } = []; public abstract System::Uri Url(IOrbClient client); protected static void AddQueryElementToCollection( - Specialized::NameValueCollection collection, + NameValueCollection collection, string key, - Json::JsonElement element + JsonElement element ) { switch (element.ValueKind) { - case Json::JsonValueKind.Undefined: - case Json::JsonValueKind.Null: + case JsonValueKind.Undefined: + case JsonValueKind.Null: collection.Add(key, ""); break; - case Json::JsonValueKind.String: - case Json::JsonValueKind.Number: + case JsonValueKind.String: + case JsonValueKind.Number: collection.Add(key, element.ToString()); break; - case Json::JsonValueKind.True: + case JsonValueKind.True: collection.Add(key, "true"); break; - case Json::JsonValueKind.False: + case JsonValueKind.False: collection.Add(key, "false"); break; - case Json::JsonValueKind.Object: + case JsonValueKind.Object: foreach (var item in element.EnumerateObject()) { AddQueryElementToCollection( @@ -48,16 +48,16 @@ protected static void AddQueryElementToCollection( ); } break; - case Json::JsonValueKind.Array: + case JsonValueKind.Array: foreach (var item in element.EnumerateArray()) { collection.Add( string.Format("{0}[]", key), item.ValueKind switch { - Json::JsonValueKind.Null => "", - Json::JsonValueKind.True => "true", - Json::JsonValueKind.False => "false", + JsonValueKind.Null => "", + JsonValueKind.True => "true", + JsonValueKind.False => "false", _ => item.GetString(), } ); @@ -67,28 +67,28 @@ protected static void AddQueryElementToCollection( } protected static void AddHeaderElementToRequest( - Http::HttpRequestMessage request, + HttpRequestMessage request, string key, - Json::JsonElement element + JsonElement element ) { switch (element.ValueKind) { - case Json::JsonValueKind.Undefined: - case Json::JsonValueKind.Null: + case JsonValueKind.Undefined: + case JsonValueKind.Null: request.Headers.Add(key, ""); break; - case Json::JsonValueKind.String: - case Json::JsonValueKind.Number: + case JsonValueKind.String: + case JsonValueKind.Number: request.Headers.Add(key, element.ToString()); break; - case Json::JsonValueKind.True: + case JsonValueKind.True: request.Headers.Add(key, "true"); break; - case Json::JsonValueKind.False: + case JsonValueKind.False: request.Headers.Add(key, "false"); break; - case Json::JsonValueKind.Object: + case JsonValueKind.Object: foreach (var item in element.EnumerateObject()) { AddHeaderElementToRequest( @@ -98,16 +98,16 @@ protected static void AddHeaderElementToRequest( ); } break; - case Json::JsonValueKind.Array: + case JsonValueKind.Array: foreach (var item in element.EnumerateArray()) { request.Headers.Add( key, item.ValueKind switch { - Json::JsonValueKind.Null => "", - Json::JsonValueKind.True => "true", - Json::JsonValueKind.False => "false", + JsonValueKind.Null => "", + JsonValueKind.True => "true", + JsonValueKind.False => "false", _ => item.GetString(), } ); @@ -118,12 +118,12 @@ protected static void AddHeaderElementToRequest( protected string QueryString(IOrbClient client) { - Specialized::NameValueCollection collection = []; + NameValueCollection collection = []; foreach (var item in this.QueryProperties) { ParamsBase.AddQueryElementToCollection(collection, item.Key, item.Value); } - Text::StringBuilder sb = new(); + StringBuilder sb = new(); bool first = true; foreach (var key in collection.AllKeys) { @@ -142,7 +142,7 @@ protected string QueryString(IOrbClient client) return sb.ToString(); } - protected static void AddDefaultHeaders(Http::HttpRequestMessage request, IOrbClient client) + protected static void AddDefaultHeaders(HttpRequestMessage request, IOrbClient client) { request.Headers.Add("Authorization", string.Format("Bearer {0}", client.APIKey)); } diff --git a/src/Orb/Service/Alerts/AlertService.cs b/src/Orb/Service/Alerts/AlertService.cs index 2326a4d1..8c987c63 100644 --- a/src/Orb/Service/Alerts/AlertService.cs +++ b/src/Orb/Service/Alerts/AlertService.cs @@ -1,180 +1,166 @@ -using Alerts = Orb.Models.Alerts; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Alerts; namespace Orb.Service.Alerts; public sealed class AlertService : IAlertService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public AlertService(Orb::IOrbClient client) + public AlertService(IOrbClient client) { _client = client; } - public async Tasks::Task Retrieve(Alerts::AlertRetrieveParams @params) + public async Task Retrieve(AlertRetrieveParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Alerts::AlertUpdateParams @params) + public async Task Update(AlertUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List(Alerts::AlertListParams @params) + public async Task List(AlertListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task CreateForCustomer( - Alerts::AlertCreateForCustomerParams @params - ) + public async Task CreateForCustomer(AlertCreateForCustomerParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task CreateForExternalCustomer( - Alerts::AlertCreateForExternalCustomerParams @params - ) + public async Task CreateForExternalCustomer(AlertCreateForExternalCustomerParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task CreateForSubscription( - Alerts::AlertCreateForSubscriptionParams @params - ) + public async Task CreateForSubscription(AlertCreateForSubscriptionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Disable(Alerts::AlertDisableParams @params) + public async Task Disable(AlertDisableParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Enable(Alerts::AlertEnableParams @params) + public async Task Enable(AlertEnableParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Alerts/IAlertService.cs b/src/Orb/Service/Alerts/IAlertService.cs index fdc8c32f..693e4c0e 100644 --- a/src/Orb/Service/Alerts/IAlertService.cs +++ b/src/Orb/Service/Alerts/IAlertService.cs @@ -1,5 +1,5 @@ -using Alerts = Orb.Models.Alerts; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Alerts; namespace Orb.Service.Alerts; @@ -8,12 +8,12 @@ public interface IAlertService /// /// This endpoint retrieves an alert by its ID. /// - Tasks::Task Retrieve(Alerts::AlertRetrieveParams @params); + Task Retrieve(AlertRetrieveParams @params); /// /// This endpoint updates the thresholds of an alert. /// - Tasks::Task Update(Alerts::AlertUpdateParams @params); + Task Update(AlertUpdateParams @params); /// /// This endpoint returns a list of alerts within Orb. @@ -26,7 +26,7 @@ public interface IAlertService /// The list of alerts is ordered starting from the most recently created alert. /// This endpoint follows Orb's [standardized pagination format](/api-reference/pagination). /// - Tasks::Task List(Alerts::AlertListParams @params); + Task List(AlertListParams @params); /// /// This endpoint creates a new alert to monitor a customer's credit balance. There @@ -37,7 +37,7 @@ public interface IAlertService /// while `credit_balance_depleted` and `credit_balance_recovered` alerts do not /// require thresholds. /// - Tasks::Task CreateForCustomer(Alerts::AlertCreateForCustomerParams @params); + Task CreateForCustomer(AlertCreateForCustomerParams @params); /// /// This endpoint creates a new alert to monitor a customer's credit balance. There @@ -48,9 +48,7 @@ public interface IAlertService /// while `credit_balance_depleted` and `credit_balance_recovered` alerts do not /// require thresholds. /// - Tasks::Task CreateForExternalCustomer( - Alerts::AlertCreateForExternalCustomerParams @params - ); + Task CreateForExternalCustomer(AlertCreateForExternalCustomerParams @params); /// /// This endpoint is used to create alerts at the subscription level. @@ -65,21 +63,19 @@ public interface IAlertService /// is a part of the subscription. Alerts are triggered based on usage or cost /// conditions met during the current billing cycle. /// - Tasks::Task CreateForSubscription( - Alerts::AlertCreateForSubscriptionParams @params - ); + Task CreateForSubscription(AlertCreateForSubscriptionParams @params); /// /// This endpoint allows you to disable an alert. To disable a plan-level alert /// for a specific subscription, you must include the `subscription_id`. The `subscription_id` /// is not required for customer or subscription level alerts. /// - Tasks::Task Disable(Alerts::AlertDisableParams @params); + Task Disable(AlertDisableParams @params); /// /// This endpoint allows you to enable an alert. To enable a plan-level alert for /// a specific subscription, you must include the `subscription_id`. The `subscription_id` /// is not required for customer or subscription level alerts. /// - Tasks::Task Enable(Alerts::AlertEnableParams @params); + Task Enable(AlertEnableParams @params); } diff --git a/src/Orb/Service/Beta/BetaService.cs b/src/Orb/Service/Beta/BetaService.cs index ad2dbaf3..d458891a 100644 --- a/src/Orb/Service/Beta/BetaService.cs +++ b/src/Orb/Service/Beta/BetaService.cs @@ -1,93 +1,83 @@ -using Beta = Orb.Models.Beta; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Beta; +using Orb.Models.Plans; using ExternalPlanID = Orb.Service.Beta.ExternalPlanID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using Plans = Orb.Models.Plans; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Beta; public sealed class BetaService : IBetaService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public BetaService(Orb::IOrbClient client) + public BetaService(IOrbClient client) { _client = client; _externalPlanID = new(() => new ExternalPlanID::ExternalPlanIDService(client)); } - readonly System::Lazy _externalPlanID; + readonly Lazy _externalPlanID; public ExternalPlanID::IExternalPlanIDService ExternalPlanID { get { return _externalPlanID.Value; } } - public async Tasks::Task CreatePlanVersion( - Beta::BetaCreatePlanVersionParams @params - ) + public async Task CreatePlanVersion(BetaCreatePlanVersionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task FetchPlanVersion( - Beta::BetaFetchPlanVersionParams @params - ) + public async Task FetchPlanVersion(BetaFetchPlanVersionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task SetDefaultPlanVersion( - Beta::BetaSetDefaultPlanVersionParams @params - ) + public async Task SetDefaultPlanVersion(BetaSetDefaultPlanVersionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Beta/ExternalPlanID/ExternalPlanIDService.cs b/src/Orb/Service/Beta/ExternalPlanID/ExternalPlanIDService.cs index 0f1d9363..b108b705 100644 --- a/src/Orb/Service/Beta/ExternalPlanID/ExternalPlanIDService.cs +++ b/src/Orb/Service/Beta/ExternalPlanID/ExternalPlanIDService.cs @@ -1,86 +1,76 @@ -using Beta = Orb.Models.Beta; -using ExternalPlanID = Orb.Models.Beta.ExternalPlanID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using Plans = Orb.Models.Plans; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Beta; +using Orb.Models.Beta.ExternalPlanID; +using Orb.Models.Plans; namespace Orb.Service.Beta.ExternalPlanID; public sealed class ExternalPlanIDService : IExternalPlanIDService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public ExternalPlanIDService(Orb::IOrbClient client) + public ExternalPlanIDService(IOrbClient client) { _client = client; } - public async Tasks::Task CreatePlanVersion( - ExternalPlanID::ExternalPlanIDCreatePlanVersionParams @params - ) + public async Task CreatePlanVersion(ExternalPlanIDCreatePlanVersionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task FetchPlanVersion( - ExternalPlanID::ExternalPlanIDFetchPlanVersionParams @params - ) + public async Task FetchPlanVersion(ExternalPlanIDFetchPlanVersionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task SetDefaultPlanVersion( - ExternalPlanID::ExternalPlanIDSetDefaultPlanVersionParams @params - ) + public async Task SetDefaultPlanVersion(ExternalPlanIDSetDefaultPlanVersionParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Beta/ExternalPlanID/IExternalPlanIDService.cs b/src/Orb/Service/Beta/ExternalPlanID/IExternalPlanIDService.cs index e271d366..83b40890 100644 --- a/src/Orb/Service/Beta/ExternalPlanID/IExternalPlanIDService.cs +++ b/src/Orb/Service/Beta/ExternalPlanID/IExternalPlanIDService.cs @@ -1,7 +1,7 @@ -using Beta = Orb.Models.Beta; -using ExternalPlanID = Orb.Models.Beta.ExternalPlanID; -using Plans = Orb.Models.Plans; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Beta; +using Orb.Models.Beta.ExternalPlanID; +using Orb.Models.Plans; namespace Orb.Service.Beta.ExternalPlanID; @@ -13,9 +13,7 @@ public interface IExternalPlanIDService /// /// This endpoint allows the creation of a new plan version for an existing plan. /// - Tasks::Task CreatePlanVersion( - ExternalPlanID::ExternalPlanIDCreatePlanVersionParams @params - ); + Task CreatePlanVersion(ExternalPlanIDCreatePlanVersionParams @params); /// /// This API endpoint is in beta and its interface may change. It is recommended @@ -24,9 +22,7 @@ public interface IExternalPlanIDService /// This endpoint is used to fetch a plan version. It returns the phases, prices, /// and adjustments present on this version of the plan. /// - Tasks::Task FetchPlanVersion( - ExternalPlanID::ExternalPlanIDFetchPlanVersionParams @params - ); + Task FetchPlanVersion(ExternalPlanIDFetchPlanVersionParams @params); /// /// This API endpoint is in beta and its interface may change. It is recommended @@ -34,7 +30,5 @@ public interface IExternalPlanIDService /// /// This endpoint allows setting the default version of a plan. /// - Tasks::Task SetDefaultPlanVersion( - ExternalPlanID::ExternalPlanIDSetDefaultPlanVersionParams @params - ); + Task SetDefaultPlanVersion(ExternalPlanIDSetDefaultPlanVersionParams @params); } diff --git a/src/Orb/Service/Beta/IBetaService.cs b/src/Orb/Service/Beta/IBetaService.cs index 4a423a31..33248b8f 100644 --- a/src/Orb/Service/Beta/IBetaService.cs +++ b/src/Orb/Service/Beta/IBetaService.cs @@ -1,7 +1,7 @@ -using Beta = Orb.Models.Beta; +using System.Threading.Tasks; +using Orb.Models.Beta; +using Orb.Models.Plans; using ExternalPlanID = Orb.Service.Beta.ExternalPlanID; -using Plans = Orb.Models.Plans; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Beta; @@ -15,7 +15,7 @@ public interface IBetaService /// /// This endpoint allows the creation of a new plan version for an existing plan. /// - Tasks::Task CreatePlanVersion(Beta::BetaCreatePlanVersionParams @params); + Task CreatePlanVersion(BetaCreatePlanVersionParams @params); /// /// This API endpoint is in beta and its interface may change. It is recommended @@ -24,7 +24,7 @@ public interface IBetaService /// This endpoint is used to fetch a plan version. It returns the phases, prices, /// and adjustments present on this version of the plan. /// - Tasks::Task FetchPlanVersion(Beta::BetaFetchPlanVersionParams @params); + Task FetchPlanVersion(BetaFetchPlanVersionParams @params); /// /// This API endpoint is in beta and its interface may change. It is recommended @@ -32,5 +32,5 @@ public interface IBetaService /// /// This endpoint allows setting the default version of a plan. /// - Tasks::Task SetDefaultPlanVersion(Beta::BetaSetDefaultPlanVersionParams @params); + Task SetDefaultPlanVersion(BetaSetDefaultPlanVersionParams @params); } diff --git a/src/Orb/Service/Coupons/CouponService.cs b/src/Orb/Service/Coupons/CouponService.cs index 1c0e7aad..e77cf10f 100644 --- a/src/Orb/Service/Coupons/CouponService.cs +++ b/src/Orb/Service/Coupons/CouponService.cs @@ -1,103 +1,97 @@ -using Coupons = Orb.Models.Coupons; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Coupons; using Subscriptions = Orb.Service.Coupons.Subscriptions; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Coupons; public sealed class CouponService : ICouponService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public CouponService(Orb::IOrbClient client) + public CouponService(IOrbClient client) { _client = client; _subscriptions = new(() => new Subscriptions::SubscriptionService(client)); } - readonly System::Lazy _subscriptions; + readonly Lazy _subscriptions; public Subscriptions::ISubscriptionService Subscriptions { get { return _subscriptions.Value; } } - public async Tasks::Task Create(Coupons::CouponCreateParams @params) + public async Task Create(CouponCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List( - Coupons::CouponListParams @params - ) + public async Task List(CouponListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Archive(Coupons::CouponArchiveParams @params) + public async Task Archive(CouponArchiveParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(Coupons::CouponFetchParams @params) + public async Task Fetch(CouponFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Coupons/ICouponService.cs b/src/Orb/Service/Coupons/ICouponService.cs index 441e168b..4d9c54a0 100644 --- a/src/Orb/Service/Coupons/ICouponService.cs +++ b/src/Orb/Service/Coupons/ICouponService.cs @@ -1,6 +1,6 @@ -using Coupons = Orb.Models.Coupons; +using System.Threading.Tasks; +using Orb.Models.Coupons; using Subscriptions = Orb.Service.Coupons.Subscriptions; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Coupons; @@ -12,7 +12,7 @@ public interface ICouponService /// This endpoint allows the creation of coupons, which can then be redeemed at /// subscription creation or plan change. /// - Tasks::Task Create(Coupons::CouponCreateParams @params); + Task Create(CouponCreateParams @params); /// /// This endpoint returns a list of all coupons for an account in a list format. @@ -22,18 +22,18 @@ public interface ICouponService /// the next page of results if they exist. More information about pagination can /// be found in the Pagination-metadata schema. /// - Tasks::Task List(Coupons::CouponListParams @params); + Task List(CouponListParams @params); /// /// This endpoint allows a coupon to be archived. Archived coupons can no longer /// be redeemed, and will be hidden from lists of active coupons. Additionally, /// once a coupon is archived, its redemption code can be reused for a different coupon. /// - Tasks::Task Archive(Coupons::CouponArchiveParams @params); + Task Archive(CouponArchiveParams @params); /// /// This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption /// code, use the [List coupons](list-coupons) endpoint with the redemption_code parameter. /// - Tasks::Task Fetch(Coupons::CouponFetchParams @params); + Task Fetch(CouponFetchParams @params); } diff --git a/src/Orb/Service/Coupons/Subscriptions/ISubscriptionService.cs b/src/Orb/Service/Coupons/Subscriptions/ISubscriptionService.cs index c7369e98..e30cec57 100644 --- a/src/Orb/Service/Coupons/Subscriptions/ISubscriptionService.cs +++ b/src/Orb/Service/Coupons/Subscriptions/ISubscriptionService.cs @@ -1,6 +1,5 @@ -using Subscriptions = Orb.Models.Subscriptions; -using Subscriptions1 = Orb.Models.Coupons.Subscriptions; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Subscriptions; namespace Orb.Service.Coupons.Subscriptions; @@ -12,5 +11,7 @@ public interface ISubscriptionService /// the most recently created subscription. For a full discussion of the subscription /// resource, see [Subscription](/core-concepts#subscription). /// - Tasks::Task List(Subscriptions1::SubscriptionListParams @params); + Task List( + global::Orb.Models.Coupons.Subscriptions.SubscriptionListParams @params + ); } diff --git a/src/Orb/Service/Coupons/Subscriptions/SubscriptionService.cs b/src/Orb/Service/Coupons/Subscriptions/SubscriptionService.cs index b74143b7..a5457d6b 100644 --- a/src/Orb/Service/Coupons/Subscriptions/SubscriptionService.cs +++ b/src/Orb/Service/Coupons/Subscriptions/SubscriptionService.cs @@ -1,39 +1,36 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Coupons.Subscriptions; using Subscriptions = Orb.Models.Subscriptions; -using Subscriptions1 = Orb.Models.Coupons.Subscriptions; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Coupons.Subscriptions; public sealed class SubscriptionService : ISubscriptionService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public SubscriptionService(Orb::IOrbClient client) + public SubscriptionService(IOrbClient client) { _client = client; } - public async Tasks::Task List( - Subscriptions1::SubscriptionListParams @params - ) + public async Task List(SubscriptionListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/CreditNotes/CreditNoteService.cs b/src/Orb/Service/CreditNotes/CreditNoteService.cs index 9fa4cefc..b0998b99 100644 --- a/src/Orb/Service/CreditNotes/CreditNoteService.cs +++ b/src/Orb/Service/CreditNotes/CreditNoteService.cs @@ -1,78 +1,73 @@ -using CreditNotes = Orb.Models.CreditNotes; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.CreditNotes; namespace Orb.Service.CreditNotes; public sealed class CreditNoteService : ICreditNoteService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public CreditNoteService(Orb::IOrbClient client) + public CreditNoteService(IOrbClient client) { _client = client; } - public async Tasks::Task Create(CreditNotes::CreditNoteCreateParams @params) + public async Task Create(CreditNoteCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List( - CreditNotes::CreditNoteListParams @params - ) + public async Task List(CreditNoteListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(CreditNotes::CreditNoteFetchParams @params) + public async Task Fetch(CreditNoteFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/CreditNotes/ICreditNoteService.cs b/src/Orb/Service/CreditNotes/ICreditNoteService.cs index 5c6b74e1..2b0fa88f 100644 --- a/src/Orb/Service/CreditNotes/ICreditNoteService.cs +++ b/src/Orb/Service/CreditNotes/ICreditNoteService.cs @@ -1,6 +1,6 @@ -using CreditNotes = Orb.Models.CreditNotes; -using Models = Orb.Models; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.CreditNotes; namespace Orb.Service.CreditNotes; @@ -33,20 +33,18 @@ public interface ICreditNoteService /// both the start date and end date completely (from start of start_date to end /// of end_date). /// - Tasks::Task Create(CreditNotes::CreditNoteCreateParams @params); + Task Create(CreditNoteCreateParams @params); /// /// Get a paginated list of CreditNotes. Users can also filter by customer_id, subscription_id, /// or external_customer_id. The credit notes will be returned in reverse chronological /// order by `creation_time`. /// - Tasks::Task List( - CreditNotes::CreditNoteListParams @params - ); + Task List(CreditNoteListParams @params); /// /// This endpoint is used to fetch a single [`Credit Note`](/invoicing/credit-notes) /// given an identifier. /// - Tasks::Task Fetch(CreditNotes::CreditNoteFetchParams @params); + Task Fetch(CreditNoteFetchParams @params); } diff --git a/src/Orb/Service/Customers/BalanceTransactions/BalanceTransactionService.cs b/src/Orb/Service/Customers/BalanceTransactions/BalanceTransactionService.cs index fe0d770a..5d288e98 100644 --- a/src/Orb/Service/Customers/BalanceTransactions/BalanceTransactionService.cs +++ b/src/Orb/Service/Customers/BalanceTransactions/BalanceTransactionService.cs @@ -1,61 +1,58 @@ -using BalanceTransactions = Orb.Models.Customers.BalanceTransactions; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Customers.BalanceTransactions; namespace Orb.Service.Customers.BalanceTransactions; public sealed class BalanceTransactionService : IBalanceTransactionService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public BalanceTransactionService(Orb::IOrbClient client) + public BalanceTransactionService(IOrbClient client) { _client = client; } - public async Tasks::Task Create( - BalanceTransactions::BalanceTransactionCreateParams @params + public async Task Create( + BalanceTransactionCreateParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task List( - BalanceTransactions::BalanceTransactionListParams @params - ) + public async Task List(BalanceTransactionListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Customers/BalanceTransactions/IBalanceTransactionService.cs b/src/Orb/Service/Customers/BalanceTransactions/IBalanceTransactionService.cs index 8a34f7e5..725dd8fd 100644 --- a/src/Orb/Service/Customers/BalanceTransactions/IBalanceTransactionService.cs +++ b/src/Orb/Service/Customers/BalanceTransactions/IBalanceTransactionService.cs @@ -1,5 +1,5 @@ -using BalanceTransactions = Orb.Models.Customers.BalanceTransactions; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Customers.BalanceTransactions; namespace Orb.Service.Customers.BalanceTransactions; @@ -9,9 +9,7 @@ public interface IBalanceTransactionService /// Creates an immutable balance transaction that updates the customer's balance /// and returns back the newly created transaction. /// - Tasks::Task Create( - BalanceTransactions::BalanceTransactionCreateParams @params - ); + Task Create(BalanceTransactionCreateParams @params); /// /// ## The customer balance @@ -36,7 +34,5 @@ public interface IBalanceTransactionService /// order for a single customer, providing a complete audit trail of all adjustments /// and invoice applications. /// - Tasks::Task List( - BalanceTransactions::BalanceTransactionListParams @params - ); + Task List(BalanceTransactionListParams @params); } diff --git a/src/Orb/Service/Customers/Costs/CostService.cs b/src/Orb/Service/Customers/Costs/CostService.cs index 743d300a..9a6ebb02 100644 --- a/src/Orb/Service/Customers/Costs/CostService.cs +++ b/src/Orb/Service/Customers/Costs/CostService.cs @@ -1,56 +1,55 @@ -using Costs = Orb.Models.Customers.Costs; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Customers.Costs; namespace Orb.Service.Customers.Costs; public sealed class CostService : ICostService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public CostService(Orb::IOrbClient client) + public CostService(IOrbClient client) { _client = client; } - public async Tasks::Task List(Costs::CostListParams @params) + public async Task List(CostListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task ListByExternalID( - Costs::CostListByExternalIDParams @params + public async Task ListByExternalID( + CostListByExternalIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Customers/Costs/ICostService.cs b/src/Orb/Service/Customers/Costs/ICostService.cs index 66567259..54d8eb59 100644 --- a/src/Orb/Service/Customers/Costs/ICostService.cs +++ b/src/Orb/Service/Customers/Costs/ICostService.cs @@ -1,5 +1,5 @@ -using Costs = Orb.Models.Customers.Costs; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Customers.Costs; namespace Orb.Service.Customers.Costs; @@ -103,7 +103,7 @@ public interface ICostService /// the `grouping_key` and `secondary_grouping_key` based on the matrix price definition, /// for each `grouping_value` and `secondary_grouping_value` available. /// - Tasks::Task List(Costs::CostListParams @params); + Task List(CostListParams @params); /// /// This endpoint is used to fetch a day-by-day snapshot of a customer's costs @@ -203,7 +203,5 @@ public interface ICostService /// the `grouping_key` and `secondary_grouping_key` based on the matrix price definition, /// for each `grouping_value` and `secondary_grouping_value` available. /// - Tasks::Task ListByExternalID( - Costs::CostListByExternalIDParams @params - ); + Task ListByExternalID(CostListByExternalIDParams @params); } diff --git a/src/Orb/Service/Customers/Credits/CreditService.cs b/src/Orb/Service/Customers/Credits/CreditService.cs index 83efb9da..50d97f40 100644 --- a/src/Orb/Service/Customers/Credits/CreditService.cs +++ b/src/Orb/Service/Customers/Credits/CreditService.cs @@ -1,74 +1,71 @@ -using Credits = Orb.Models.Customers.Credits; -using Http = System.Net.Http; -using Json = System.Text.Json; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits; using Ledger = Orb.Service.Customers.Credits.Ledger; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; using TopUps = Orb.Service.Customers.Credits.TopUps; namespace Orb.Service.Customers.Credits; public sealed class CreditService : ICreditService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public CreditService(Orb::IOrbClient client) + public CreditService(IOrbClient client) { _client = client; _ledger = new(() => new Ledger::LedgerService(client)); _topUps = new(() => new TopUps::TopUpService(client)); } - readonly System::Lazy _ledger; + readonly Lazy _ledger; public Ledger::ILedgerService Ledger { get { return _ledger.Value; } } - readonly System::Lazy _topUps; + readonly Lazy _topUps; public TopUps::ITopUpService TopUps { get { return _topUps.Value; } } - public async Tasks::Task List( - Credits::CreditListParams @params - ) + public async Task List(CreditListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task ListByExternalID( - Credits::CreditListByExternalIDParams @params + public async Task ListByExternalID( + CreditListByExternalIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Customers/Credits/ICreditService.cs b/src/Orb/Service/Customers/Credits/ICreditService.cs index c35cb37f..359b441d 100644 --- a/src/Orb/Service/Customers/Credits/ICreditService.cs +++ b/src/Orb/Service/Customers/Credits/ICreditService.cs @@ -1,6 +1,6 @@ -using Credits = Orb.Models.Customers.Credits; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits; using Ledger = Orb.Service.Customers.Credits.Ledger; -using Tasks = System.Threading.Tasks; using TopUps = Orb.Service.Customers.Credits.TopUps; namespace Orb.Service.Customers.Credits; @@ -20,7 +20,7 @@ public interface ICreditService /// Note that `currency` defaults to credits if not specified. To use a real world /// currency, set `currency` to an ISO 4217 string. /// - Tasks::Task List(Credits::CreditListParams @params); + Task List(CreditListParams @params); /// /// Returns a paginated list of unexpired, non-zero credit blocks for a customer. @@ -31,7 +31,5 @@ public interface ICreditService /// Note that `currency` defaults to credits if not specified. To use a real world /// currency, set `currency` to an ISO 4217 string. /// - Tasks::Task ListByExternalID( - Credits::CreditListByExternalIDParams @params - ); + Task ListByExternalID(CreditListByExternalIDParams @params); } diff --git a/src/Orb/Service/Customers/Credits/Ledger/ILedgerService.cs b/src/Orb/Service/Customers/Credits/Ledger/ILedgerService.cs index 7de67afc..0e38f673 100644 --- a/src/Orb/Service/Customers/Credits/Ledger/ILedgerService.cs +++ b/src/Orb/Service/Customers/Credits/Ledger/ILedgerService.cs @@ -1,5 +1,5 @@ -using Ledger = Orb.Models.Customers.Credits.Ledger; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits.Ledger; namespace Orb.Service.Customers.Credits.Ledger; @@ -73,7 +73,7 @@ public interface ILedgerService /// correction, this entry will be added to the ledger to indicate the adjustment /// of credits. /// - Tasks::Task List(Ledger::LedgerListParams @params); + Task List(LedgerListParams @params); /// /// This endpoint allows you to create a new ledger entry for a specified customer's @@ -157,9 +157,7 @@ public interface ILedgerService /// block that was originally decremented from, and `amount` indicates how many /// credits to return to the customer, up to the block's initial balance. /// - Tasks::Task CreateEntry( - Ledger::LedgerCreateEntryParams @params - ); + Task CreateEntry(LedgerCreateEntryParams @params); /// /// This endpoint allows you to create a new ledger entry for a specified customer's @@ -243,8 +241,8 @@ public interface ILedgerService /// block that was originally decremented from, and `amount` indicates how many /// credits to return to the customer, up to the block's initial balance. /// - Tasks::Task CreateEntryByExternalID( - Ledger::LedgerCreateEntryByExternalIDParams @params + Task CreateEntryByExternalID( + LedgerCreateEntryByExternalIDParams @params ); /// @@ -315,7 +313,5 @@ public interface ILedgerService /// correction, this entry will be added to the ledger to indicate the adjustment /// of credits. /// - Tasks::Task ListByExternalID( - Ledger::LedgerListByExternalIDParams @params - ); + Task ListByExternalID(LedgerListByExternalIDParams @params); } diff --git a/src/Orb/Service/Customers/Credits/Ledger/LedgerService.cs b/src/Orb/Service/Customers/Credits/Ledger/LedgerService.cs index 4dd8c51a..29a191d7 100644 --- a/src/Orb/Service/Customers/Credits/Ledger/LedgerService.cs +++ b/src/Orb/Service/Customers/Credits/Ledger/LedgerService.cs @@ -1,102 +1,99 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Ledger = Orb.Models.Customers.Credits.Ledger; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits.Ledger; namespace Orb.Service.Customers.Credits.Ledger; public sealed class LedgerService : ILedgerService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public LedgerService(Orb::IOrbClient client) + public LedgerService(IOrbClient client) { _client = client; } - public async Tasks::Task List(Ledger::LedgerListParams @params) + public async Task List(LedgerListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task CreateEntry( - Ledger::LedgerCreateEntryParams @params - ) + public async Task CreateEntry(LedgerCreateEntryParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task CreateEntryByExternalID( - Ledger::LedgerCreateEntryByExternalIDParams @params + public async Task CreateEntryByExternalID( + LedgerCreateEntryByExternalIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task ListByExternalID( - Ledger::LedgerListByExternalIDParams @params + public async Task ListByExternalID( + LedgerListByExternalIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Customers/Credits/TopUps/ITopUpService.cs b/src/Orb/Service/Customers/Credits/TopUps/ITopUpService.cs index a908b033..d982a31e 100644 --- a/src/Orb/Service/Customers/Credits/TopUps/ITopUpService.cs +++ b/src/Orb/Service/Customers/Credits/TopUps/ITopUpService.cs @@ -1,5 +1,5 @@ -using Tasks = System.Threading.Tasks; -using TopUps = Orb.Models.Customers.Credits.TopUps; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits.TopUps; namespace Orb.Service.Customers.Credits.TopUps; @@ -13,18 +13,18 @@ public interface ITopUpService /// If a top-up already exists for this customer in the same currency, the existing /// top-up will be replaced. /// - Tasks::Task Create(TopUps::TopUpCreateParams @params); + Task Create(TopUpCreateParams @params); /// /// List top-ups /// - Tasks::Task List(TopUps::TopUpListParams @params); + Task List(TopUpListParams @params); /// /// This deactivates the top-up and voids any invoices associated with pending /// credit blocks purchased through the top-up. /// - Tasks::Task Delete(TopUps::TopUpDeleteParams @params); + Task Delete(TopUpDeleteParams @params); /// /// This endpoint allows you to create a new top-up for a specified customer's @@ -34,20 +34,16 @@ public interface ITopUpService /// If a top-up already exists for this customer in the same currency, the existing /// top-up will be replaced. /// - Tasks::Task CreateByExternalID( - TopUps::TopUpCreateByExternalIDParams @params - ); + Task CreateByExternalID(TopUpCreateByExternalIDParams @params); /// /// This deactivates the top-up and voids any invoices associated with pending /// credit blocks purchased through the top-up. /// - Tasks::Task DeleteByExternalID(TopUps::TopUpDeleteByExternalIDParams @params); + Task DeleteByExternalID(TopUpDeleteByExternalIDParams @params); /// /// List top-ups by external ID /// - Tasks::Task ListByExternalID( - TopUps::TopUpListByExternalIDParams @params - ); + Task ListByExternalID(TopUpListByExternalIDParams @params); } diff --git a/src/Orb/Service/Customers/Credits/TopUps/TopUpService.cs b/src/Orb/Service/Customers/Credits/TopUps/TopUpService.cs index 0f5ff9cc..0a6d41a7 100644 --- a/src/Orb/Service/Customers/Credits/TopUps/TopUpService.cs +++ b/src/Orb/Service/Customers/Credits/TopUps/TopUpService.cs @@ -1,136 +1,129 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; -using TopUps = Orb.Models.Customers.Credits.TopUps; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Customers.Credits.TopUps; namespace Orb.Service.Customers.Credits.TopUps; public sealed class TopUpService : ITopUpService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public TopUpService(Orb::IOrbClient client) + public TopUpService(IOrbClient client) { _client = client; } - public async Tasks::Task Create(TopUps::TopUpCreateParams @params) + public async Task Create(TopUpCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task List(TopUps::TopUpListParams @params) + public async Task List(TopUpListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Delete(TopUps::TopUpDeleteParams @params) + public async Task Delete(TopUpDeleteParams @params) { - Http::HttpRequestMessage webRequest = new( - Http::HttpMethod.Delete, - @params.Url(this._client) - ); + HttpRequestMessage webRequest = new(HttpMethod.Delete, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } } - public async Tasks::Task CreateByExternalID( - TopUps::TopUpCreateByExternalIDParams @params + public async Task CreateByExternalID( + TopUpCreateByExternalIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task DeleteByExternalID(TopUps::TopUpDeleteByExternalIDParams @params) + public async Task DeleteByExternalID(TopUpDeleteByExternalIDParams @params) { - Http::HttpRequestMessage webRequest = new( - Http::HttpMethod.Delete, - @params.Url(this._client) - ); + HttpRequestMessage webRequest = new(HttpMethod.Delete, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } } - public async Tasks::Task ListByExternalID( - TopUps::TopUpListByExternalIDParams @params + public async Task ListByExternalID( + TopUpListByExternalIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Customers/CustomerService.cs b/src/Orb/Service/Customers/CustomerService.cs index d5515136..be8cc7a1 100644 --- a/src/Orb/Service/Customers/CustomerService.cs +++ b/src/Orb/Service/Customers/CustomerService.cs @@ -1,20 +1,19 @@ +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Customers; using BalanceTransactions = Orb.Service.Customers.BalanceTransactions; using Costs = Orb.Service.Customers.Costs; using Credits = Orb.Service.Customers.Credits; -using Customers = Orb.Models.Customers; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Customers; public sealed class CustomerService : ICustomerService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public CustomerService(Orb::IOrbClient client) + public CustomerService(IOrbClient client) { _client = client; _costs = new(() => new Costs::CostService(client)); @@ -23,196 +22,182 @@ public CustomerService(Orb::IOrbClient client) ); } - readonly System::Lazy _costs; + readonly Lazy _costs; public Costs::ICostService Costs { get { return _costs.Value; } } - readonly System::Lazy _credits; + readonly Lazy _credits; public Credits::ICreditService Credits { get { return _credits.Value; } } - readonly System::Lazy _balanceTransactions; + readonly Lazy _balanceTransactions; public BalanceTransactions::IBalanceTransactionService BalanceTransactions { get { return _balanceTransactions.Value; } } - public async Tasks::Task Create(Customers::CustomerCreateParams @params) + public async Task Create(CustomerCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Customers::CustomerUpdateParams @params) + public async Task Update(CustomerUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List( - Customers::CustomerListParams @params - ) + public async Task List(CustomerListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Delete(Customers::CustomerDeleteParams @params) + public async Task Delete(CustomerDeleteParams @params) { - Http::HttpRequestMessage webRequest = new( - Http::HttpMethod.Delete, - @params.Url(this._client) - ); + HttpRequestMessage webRequest = new(HttpMethod.Delete, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } } - public async Tasks::Task Fetch(Customers::CustomerFetchParams @params) + public async Task Fetch(CustomerFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task FetchByExternalID( - Customers::CustomerFetchByExternalIDParams @params - ) + public async Task FetchByExternalID(CustomerFetchByExternalIDParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task SyncPaymentMethodsFromGateway( - Customers::CustomerSyncPaymentMethodsFromGatewayParams @params + public async Task SyncPaymentMethodsFromGateway( + CustomerSyncPaymentMethodsFromGatewayParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } } - public async Tasks::Task SyncPaymentMethodsFromGatewayByExternalCustomerID( - Customers::CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams @params + public async Task SyncPaymentMethodsFromGatewayByExternalCustomerID( + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } } - public async Tasks::Task UpdateByExternalID( - Customers::CustomerUpdateByExternalIDParams @params - ) + public async Task UpdateByExternalID(CustomerUpdateByExternalIDParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Customers/ICustomerService.cs b/src/Orb/Service/Customers/ICustomerService.cs index f170e2a3..d807afe1 100644 --- a/src/Orb/Service/Customers/ICustomerService.cs +++ b/src/Orb/Service/Customers/ICustomerService.cs @@ -1,8 +1,8 @@ +using System.Threading.Tasks; +using Orb.Models.Customers; using BalanceTransactions = Orb.Service.Customers.BalanceTransactions; using Costs = Orb.Service.Customers.Costs; using Credits = Orb.Service.Customers.Credits; -using Customers = Orb.Models.Customers; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Customers; @@ -25,7 +25,7 @@ public interface ICustomerService /// can be configured by setting `external_customer_id` * [Timezone localization](/essentials/timezones) /// can be configured on a per-customer basis by setting the `timezone` parameter /// - Tasks::Task Create(Customers::CustomerCreateParams @params); + Task Create(CustomerCreateParams @params); /// /// This endpoint can be used to update the `payment_provider`, `payment_provider_id`, @@ -33,7 +33,7 @@ public interface ICustomerService /// `shipping_address`, `billing_address`, and `additional_emails` of an existing /// customer. Other fields on a customer are currently immutable. /// - Tasks::Task Update(Customers::CustomerUpdateParams @params); + Task Update(CustomerUpdateParams @params); /// /// This endpoint returns a list of all customers for an account. The list of customers @@ -42,7 +42,7 @@ public interface ICustomerService /// /// See [Customer](/core-concepts##customer) for an overview of the customer model. /// - Tasks::Task List(Customers::CustomerListParams @params); + Task List(CustomerListParams @params); /// /// This performs a deletion of this customer, its subscriptions, and its invoices, @@ -58,7 +58,7 @@ public interface ICustomerService /// customer on subsequent GET requests while deletion is in process will reflect /// its deletion. /// - Tasks::Task Delete(Customers::CustomerDeleteParams @params); + Task Delete(CustomerDeleteParams @params); /// /// This endpoint is used to fetch customer details given an identifier. If the @@ -68,7 +68,7 @@ public interface ICustomerService /// See the [Customer resource](/core-concepts#customer) for a full discussion of /// the Customer model. /// - Tasks::Task Fetch(Customers::CustomerFetchParams @params); + Task Fetch(CustomerFetchParams @params); /// /// This endpoint is used to fetch customer details given an `external_customer_id` @@ -76,9 +76,7 @@ public interface ICustomerService /// /// Note that the resource and semantics of this endpoint exactly mirror [Get Customer](fetch-customer). /// - Tasks::Task FetchByExternalID( - Customers::CustomerFetchByExternalIDParams @params - ); + Task FetchByExternalID(CustomerFetchByExternalIDParams @params); /// /// Sync Orb's payment methods for the customer with their gateway. @@ -88,9 +86,7 @@ public interface ICustomerService /// /// **Note**: This functionality is currently only available for Stripe. /// - Tasks::Task SyncPaymentMethodsFromGateway( - Customers::CustomerSyncPaymentMethodsFromGatewayParams @params - ); + Task SyncPaymentMethodsFromGateway(CustomerSyncPaymentMethodsFromGatewayParams @params); /// /// Sync Orb's payment methods for the customer with their gateway. @@ -100,8 +96,8 @@ public interface ICustomerService /// /// **Note**: This functionality is currently only available for Stripe. /// - Tasks::Task SyncPaymentMethodsFromGatewayByExternalCustomerID( - Customers::CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams @params + Task SyncPaymentMethodsFromGatewayByExternalCustomerID( + CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIDParams @params ); /// @@ -109,7 +105,5 @@ public interface ICustomerService /// (see [Customer ID Aliases](/events-and-metrics/customer-aliases)). Note that /// the resource and semantics of this endpoint exactly mirror [Update Customer](update-customer). /// - Tasks::Task UpdateByExternalID( - Customers::CustomerUpdateByExternalIDParams @params - ); + Task UpdateByExternalID(CustomerUpdateByExternalIDParams @params); } diff --git a/src/Orb/Service/DimensionalPriceGroups/DimensionalPriceGroupService.cs b/src/Orb/Service/DimensionalPriceGroups/DimensionalPriceGroupService.cs index 96ef3a07..ff8545bd 100644 --- a/src/Orb/Service/DimensionalPriceGroups/DimensionalPriceGroupService.cs +++ b/src/Orb/Service/DimensionalPriceGroups/DimensionalPriceGroupService.cs @@ -1,18 +1,17 @@ -using DimensionalPriceGroups = Orb.Models.DimensionalPriceGroups; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.DimensionalPriceGroups; using ExternalDimensionalPriceGroupID = Orb.Service.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.DimensionalPriceGroups; public sealed class DimensionalPriceGroupService : IDimensionalPriceGroupService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public DimensionalPriceGroupService(Orb::IOrbClient client) + public DimensionalPriceGroupService(IOrbClient client) { _client = client; _externalDimensionalPriceGroupID = new(() => @@ -20,72 +19,87 @@ public DimensionalPriceGroupService(Orb::IOrbClient client) ); } - readonly System::Lazy _externalDimensionalPriceGroupID; + readonly Lazy _externalDimensionalPriceGroupID; public ExternalDimensionalPriceGroupID::IExternalDimensionalPriceGroupIDService ExternalDimensionalPriceGroupID { get { return _externalDimensionalPriceGroupID.Value; } } - public async Tasks::Task Create( - DimensionalPriceGroups::DimensionalPriceGroupCreateParams @params - ) + public async Task Create(DimensionalPriceGroupCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Retrieve( - DimensionalPriceGroups::DimensionalPriceGroupRetrieveParams @params - ) + public async Task Retrieve(DimensionalPriceGroupRetrieveParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task List( - DimensionalPriceGroups::DimensionalPriceGroupListParams @params - ) + public async Task Update(DimensionalPriceGroupUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) + { + Content = @params.BodyContent(), + }; + @params.AddHeadersToRequest(webRequest, this._client); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + try + { + response.EnsureSuccessStatusCode(); + } + catch (HttpRequestException e) + { + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + } + return JsonSerializer.Deserialize( + await response.Content.ReadAsStringAsync() + ) ?? throw new NullReferenceException(); + } + + public async Task List(DimensionalPriceGroupListParams @params) + { + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDService.cs b/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDService.cs index 1698f482..246a4af2 100644 --- a/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDService.cs +++ b/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/ExternalDimensionalPriceGroupIDService.cs @@ -1,39 +1,61 @@ -using DimensionalPriceGroups = Orb.Models.DimensionalPriceGroups; -using ExternalDimensionalPriceGroupID = Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.DimensionalPriceGroups; +using Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; namespace Orb.Service.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; public sealed class ExternalDimensionalPriceGroupIDService : IExternalDimensionalPriceGroupIDService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public ExternalDimensionalPriceGroupIDService(Orb::IOrbClient client) + public ExternalDimensionalPriceGroupIDService(IOrbClient client) { _client = client; } - public async Tasks::Task Retrieve( - ExternalDimensionalPriceGroupID::ExternalDimensionalPriceGroupIDRetrieveParams @params + public async Task Retrieve( + ExternalDimensionalPriceGroupIDRetrieveParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); + } + + public async Task Update( + ExternalDimensionalPriceGroupIDUpdateParams @params + ) + { + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) + { + Content = @params.BodyContent(), + }; + @params.AddHeadersToRequest(webRequest, this._client); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + try + { + response.EnsureSuccessStatusCode(); + } + catch (HttpRequestException e) + { + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + } + return JsonSerializer.Deserialize( + await response.Content.ReadAsStringAsync() + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/IExternalDimensionalPriceGroupIDService.cs b/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/IExternalDimensionalPriceGroupIDService.cs index c7f3740a..af574b8a 100644 --- a/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/IExternalDimensionalPriceGroupIDService.cs +++ b/src/Orb/Service/DimensionalPriceGroups/ExternalDimensionalPriceGroupID/IExternalDimensionalPriceGroupIDService.cs @@ -1,6 +1,6 @@ -using DimensionalPriceGroups = Orb.Models.DimensionalPriceGroups; -using ExternalDimensionalPriceGroupID = Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.DimensionalPriceGroups; +using Orb.Models.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; namespace Orb.Service.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; @@ -9,7 +9,12 @@ public interface IExternalDimensionalPriceGroupIDService /// /// Fetch dimensional price group by external ID /// - Tasks::Task Retrieve( - ExternalDimensionalPriceGroupID::ExternalDimensionalPriceGroupIDRetrieveParams @params - ); + Task Retrieve(ExternalDimensionalPriceGroupIDRetrieveParams @params); + + /// + /// This endpoint can be used to update the `external_dimensional_price_group_id` + /// and `metadata` of an existing dimensional price group. Other fields on a dimensional + /// price group are currently immutable. + /// + Task Update(ExternalDimensionalPriceGroupIDUpdateParams @params); } diff --git a/src/Orb/Service/DimensionalPriceGroups/IDimensionalPriceGroupService.cs b/src/Orb/Service/DimensionalPriceGroups/IDimensionalPriceGroupService.cs index 743e6bf5..73abef99 100644 --- a/src/Orb/Service/DimensionalPriceGroups/IDimensionalPriceGroupService.cs +++ b/src/Orb/Service/DimensionalPriceGroups/IDimensionalPriceGroupService.cs @@ -1,6 +1,6 @@ -using DimensionalPriceGroups = Orb.Models.DimensionalPriceGroups; +using System.Threading.Tasks; +using Orb.Models.DimensionalPriceGroups; using ExternalDimensionalPriceGroupID = Orb.Service.DimensionalPriceGroups.ExternalDimensionalPriceGroupID; -using Tasks = System.Threading.Tasks; namespace Orb.Service.DimensionalPriceGroups; @@ -18,21 +18,22 @@ public interface IDimensionalPriceGroupService /// widget. We can create a price group with a dimension "color" and two prices: /// one that charges \$10 per red widget and one that charges \$20 per blue widget. /// - Tasks::Task Create( - DimensionalPriceGroups::DimensionalPriceGroupCreateParams @params - ); + Task Create(DimensionalPriceGroupCreateParams @params); /// /// Fetch dimensional price group /// - Tasks::Task Retrieve( - DimensionalPriceGroups::DimensionalPriceGroupRetrieveParams @params - ); + Task Retrieve(DimensionalPriceGroupRetrieveParams @params); + + /// + /// This endpoint can be used to update the `external_dimensional_price_group_id` + /// and `metadata` of an existing dimensional price group. Other fields on a dimensional + /// price group are currently immutable. + /// + Task Update(DimensionalPriceGroupUpdateParams @params); /// /// List dimensional price groups /// - Tasks::Task List( - DimensionalPriceGroups::DimensionalPriceGroupListParams @params - ); + Task List(DimensionalPriceGroupListParams @params); } diff --git a/src/Orb/Service/Events/Backfills/BackfillService.cs b/src/Orb/Service/Events/Backfills/BackfillService.cs index 480f64b8..f2e1cece 100644 --- a/src/Orb/Service/Events/Backfills/BackfillService.cs +++ b/src/Orb/Service/Events/Backfills/BackfillService.cs @@ -1,121 +1,110 @@ -using Backfills = Orb.Models.Events.Backfills; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Events.Backfills; namespace Orb.Service.Events.Backfills; public sealed class BackfillService : IBackfillService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public BackfillService(Orb::IOrbClient client) + public BackfillService(IOrbClient client) { _client = client; } - public async Tasks::Task Create( - Backfills::BackfillCreateParams @params - ) + public async Task Create(BackfillCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task List( - Backfills::BackfillListParams @params - ) + public async Task List(BackfillListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Close( - Backfills::BackfillCloseParams @params - ) + public async Task Close(BackfillCloseParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch( - Backfills::BackfillFetchParams @params - ) + public async Task Fetch(BackfillFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Revert( - Backfills::BackfillRevertParams @params - ) + public async Task Revert(BackfillRevertParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Events/Backfills/IBackfillService.cs b/src/Orb/Service/Events/Backfills/IBackfillService.cs index 39125ccc..cd06aea8 100644 --- a/src/Orb/Service/Events/Backfills/IBackfillService.cs +++ b/src/Orb/Service/Events/Backfills/IBackfillService.cs @@ -1,5 +1,5 @@ -using Backfills = Orb.Models.Events.Backfills; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Events.Backfills; namespace Orb.Service.Events.Backfills; @@ -40,7 +40,7 @@ public interface IBackfillService /// The expressiveness of computed properties allows you to deprecate existing events /// based on both a period of time and specific property values. /// - Tasks::Task Create(Backfills::BackfillCreateParams @params); + Task Create(BackfillCreateParams @params); /// /// This endpoint returns a list of all backfills in a list format. @@ -50,7 +50,7 @@ public interface IBackfillService /// which lets the caller retrieve the next page of results if they exist. More /// information about pagination can be found in the [Pagination-metadata schema](pagination). /// - Tasks::Task List(Backfills::BackfillListParams @params); + Task List(BackfillListParams @params); /// /// Closing a backfill makes the updated usage visible in Orb. Upon closing a backfill, @@ -58,12 +58,12 @@ public interface IBackfillService /// graphs. Once all of the updates are complete, the backfill's status will transition /// to `reflected`. /// - Tasks::Task Close(Backfills::BackfillCloseParams @params); + Task Close(BackfillCloseParams @params); /// /// This endpoint is used to fetch a backfill given an identifier. /// - Tasks::Task Fetch(Backfills::BackfillFetchParams @params); + Task Fetch(BackfillFetchParams @params); /// /// Reverting a backfill undoes all the effects of closing the backfill. If the @@ -74,5 +74,5 @@ public interface IBackfillService /// If a backfill is reverted before its closed, no usage will be updated as a /// result of the backfill and it will immediately transition to `reverted`. /// - Tasks::Task Revert(Backfills::BackfillRevertParams @params); + Task Revert(BackfillRevertParams @params); } diff --git a/src/Orb/Service/Events/EventService.cs b/src/Orb/Service/Events/EventService.cs index 11678b04..434ef1a0 100644 --- a/src/Orb/Service/Events/EventService.cs +++ b/src/Orb/Service/Events/EventService.cs @@ -1,117 +1,114 @@ +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Events; using Backfills = Orb.Service.Events.Backfills; -using Events = Orb.Models.Events; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; using Volume = Orb.Service.Events.Volume; namespace Orb.Service.Events; public sealed class EventService : IEventService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public EventService(Orb::IOrbClient client) + public EventService(IOrbClient client) { _client = client; _backfills = new(() => new Backfills::BackfillService(client)); _volume = new(() => new Volume::VolumeService(client)); } - readonly System::Lazy _backfills; + readonly Lazy _backfills; public Backfills::IBackfillService Backfills { get { return _backfills.Value; } } - readonly System::Lazy _volume; + readonly Lazy _volume; public Volume::IVolumeService Volume { get { return _volume.Value; } } - public async Tasks::Task Update(Events::EventUpdateParams @params) + public async Task Update(EventUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Deprecate( - Events::EventDeprecateParams @params - ) + public async Task Deprecate(EventDeprecateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Ingest(Events::EventIngestParams @params) + public async Task Ingest(EventIngestParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Search(Events::EventSearchParams @params) + public async Task Search(EventSearchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Events/IEventService.cs b/src/Orb/Service/Events/IEventService.cs index a873b891..66c22345 100644 --- a/src/Orb/Service/Events/IEventService.cs +++ b/src/Orb/Service/Events/IEventService.cs @@ -1,6 +1,6 @@ +using System.Threading.Tasks; +using Orb.Models.Events; using Backfills = Orb.Service.Events.Backfills; -using Events = Orb.Models.Events; -using Tasks = System.Threading.Tasks; using Volume = Orb.Service.Events.Volume; namespace Orb.Service.Events; @@ -52,7 +52,7 @@ public interface IEventService /// for a single customer in a 100 day period. For higher volume updates, consider /// using the [event backfill](create-backfill) endpoint. /// - Tasks::Task Update(Events::EventUpdateParams @params); + Task Update(EventUpdateParams @params); /// /// This endpoint is used to deprecate a single usage event with a given `event_id`. @@ -90,7 +90,7 @@ public interface IEventService /// in a 100 day period. For higher volume updates, consider using the [event /// backfill](create-backfill) endpoint. /// - Tasks::Task Deprecate(Events::EventDeprecateParams @params); + Task Deprecate(EventDeprecateParams @params); /// /// Orb's event ingestion model and API is designed around two core principles: @@ -259,7 +259,7 @@ public interface IEventService /// /// ```json { "validation_failed": [] } ``` /// - Tasks::Task Ingest(Events::EventIngestParams @params); + Task Ingest(EventIngestParams @params); /// /// This endpoint returns a filtered set of events for an account in a [paginated @@ -277,5 +277,5 @@ public interface IEventService /// By default, Orb will not throw a `404` if no events matched, Orb will return /// an empty array for `data` instead. /// - Tasks::Task Search(Events::EventSearchParams @params); + Task Search(EventSearchParams @params); } diff --git a/src/Orb/Service/Events/Volume/IVolumeService.cs b/src/Orb/Service/Events/Volume/IVolumeService.cs index 4e336d72..d4b88d8d 100644 --- a/src/Orb/Service/Events/Volume/IVolumeService.cs +++ b/src/Orb/Service/Events/Volume/IVolumeService.cs @@ -1,5 +1,5 @@ -using Tasks = System.Threading.Tasks; -using Volume = Orb.Models.Events.Volume; +using System.Threading.Tasks; +using Orb.Models.Events.Volume; namespace Orb.Service.Events.Volume; @@ -18,5 +18,5 @@ public interface IVolumeService /// is passed in for either start or end time, the response includes the hours /// the timestamp falls in. /// - Tasks::Task List(Volume::VolumeListParams @params); + Task List(VolumeListParams @params); } diff --git a/src/Orb/Service/Events/Volume/VolumeService.cs b/src/Orb/Service/Events/Volume/VolumeService.cs index 7069329d..58caa656 100644 --- a/src/Orb/Service/Events/Volume/VolumeService.cs +++ b/src/Orb/Service/Events/Volume/VolumeService.cs @@ -1,36 +1,34 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; -using Volume = Orb.Models.Events.Volume; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Events.Volume; namespace Orb.Service.Events.Volume; public sealed class VolumeService : IVolumeService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public VolumeService(Orb::IOrbClient client) + public VolumeService(IOrbClient client) { _client = client; } - public async Tasks::Task List(Volume::VolumeListParams @params) + public async Task List(VolumeListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/InvoiceLineItems/IInvoiceLineItemService.cs b/src/Orb/Service/InvoiceLineItems/IInvoiceLineItemService.cs index c0eb0a3c..919b6731 100644 --- a/src/Orb/Service/InvoiceLineItems/IInvoiceLineItemService.cs +++ b/src/Orb/Service/InvoiceLineItems/IInvoiceLineItemService.cs @@ -1,5 +1,5 @@ -using InvoiceLineItems = Orb.Models.InvoiceLineItems; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.InvoiceLineItems; namespace Orb.Service.InvoiceLineItems; @@ -9,7 +9,5 @@ public interface IInvoiceLineItemService /// This creates a one-off fixed fee invoice line item on an Invoice. This can only /// be done for invoices that are in a `draft` status. /// - Tasks::Task Create( - InvoiceLineItems::InvoiceLineItemCreateParams @params - ); + Task Create(InvoiceLineItemCreateParams @params); } diff --git a/src/Orb/Service/InvoiceLineItems/InvoiceLineItemService.cs b/src/Orb/Service/InvoiceLineItems/InvoiceLineItemService.cs index ec0e73bf..5e24d60a 100644 --- a/src/Orb/Service/InvoiceLineItems/InvoiceLineItemService.cs +++ b/src/Orb/Service/InvoiceLineItems/InvoiceLineItemService.cs @@ -1,41 +1,38 @@ -using Http = System.Net.Http; -using InvoiceLineItems = Orb.Models.InvoiceLineItems; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.InvoiceLineItems; namespace Orb.Service.InvoiceLineItems; public sealed class InvoiceLineItemService : IInvoiceLineItemService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public InvoiceLineItemService(Orb::IOrbClient client) + public InvoiceLineItemService(IOrbClient client) { _client = client; } - public async Tasks::Task Create( - InvoiceLineItems::InvoiceLineItemCreateParams @params - ) + public async Task Create(InvoiceLineItemCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Invoices/IInvoiceService.cs b/src/Orb/Service/Invoices/IInvoiceService.cs index fb7b8fad..99e1c8fd 100644 --- a/src/Orb/Service/Invoices/IInvoiceService.cs +++ b/src/Orb/Service/Invoices/IInvoiceService.cs @@ -1,6 +1,6 @@ -using Invoices = Orb.Models.Invoices; -using Models = Orb.Models; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Invoices; namespace Orb.Service.Invoices; @@ -9,16 +9,17 @@ public interface IInvoiceService /// /// This endpoint is used to create a one-off invoice for a customer. /// - Tasks::Task Create(Invoices::InvoiceCreateParams @params); + Task Create(InvoiceCreateParams @params); /// - /// This endpoint allows you to update the `metadata` property on an invoice. If - /// you pass null for the metadata value, it will clear any existing metadata for - /// that invoice. + /// This endpoint allows you to update the `metadata`, `net_terms`, and `due_date` + /// properties on an invoice. If you pass null for the metadata value, it will + /// clear any existing metadata for that invoice. /// - /// `metadata` can be modified regardless of invoice state. + /// `metadata` can be modified regardless of invoice state. `net_terms` and `due_date` + /// can only be modified if the invoice is in a `draft` state. /// - Tasks::Task Update(Invoices::InvoiceUpdateParams @params); + Task Update(InvoiceUpdateParams @params); /// /// This endpoint returns a list of all [`Invoice`](/core-concepts#invoice)s for @@ -34,21 +35,19 @@ public interface IInvoiceService /// for each draft invoice, which may not always be up-to-date since Orb regularly /// refreshes invoices asynchronously. /// - Tasks::Task List(Invoices::InvoiceListParams @params); + Task List(InvoiceListParams @params); /// /// This endpoint is used to fetch an [`Invoice`](/core-concepts#invoice) given /// an identifier. /// - Tasks::Task Fetch(Invoices::InvoiceFetchParams @params); + Task Fetch(InvoiceFetchParams @params); /// /// This endpoint can be used to fetch the upcoming [invoice](/core-concepts#invoice) /// for the current billing period given a subscription. /// - Tasks::Task FetchUpcoming( - Invoices::InvoiceFetchUpcomingParams @params - ); + Task FetchUpcoming(InvoiceFetchUpcomingParams @params); /// /// This endpoint allows an eligible invoice to be issued manually. This is only @@ -57,19 +56,19 @@ public interface IInvoiceService /// possibly trigger side effects, some of which could be customer-visible (e.g. /// sending emails, auto-collecting payment, syncing the invoice to external providers, etc). /// - Tasks::Task Issue(Invoices::InvoiceIssueParams @params); + Task Issue(InvoiceIssueParams @params); /// /// This endpoint allows an invoice's status to be set the `paid` status. This /// can only be done to invoices that are in the `issued` status. /// - Tasks::Task MarkPaid(Invoices::InvoiceMarkPaidParams @params); + Task MarkPaid(InvoiceMarkPaidParams @params); /// /// This endpoint collects payment for an invoice using the customer's default /// payment method. This action can only be taken on invoices with status "issued". /// - Tasks::Task Pay(Invoices::InvoicePayParams @params); + Task Pay(InvoicePayParams @params); /// /// This endpoint allows an invoice's status to be set the `void` status. This @@ -84,5 +83,5 @@ public interface IInvoiceService /// yet paid, the credit block will be voided. If the invoice was created due to /// a top-up, the top-up will be disabled. /// - Tasks::Task Void(Invoices::InvoiceVoidParams @params); + Task Void(InvoiceVoidParams @params); } diff --git a/src/Orb/Service/Invoices/InvoiceService.cs b/src/Orb/Service/Invoices/InvoiceService.cs index b8a33c3a..bdf7d1c2 100644 --- a/src/Orb/Service/Invoices/InvoiceService.cs +++ b/src/Orb/Service/Invoices/InvoiceService.cs @@ -1,197 +1,187 @@ -using Http = System.Net.Http; -using Invoices = Orb.Models.Invoices; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Invoices; namespace Orb.Service.Invoices; public sealed class InvoiceService : IInvoiceService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public InvoiceService(Orb::IOrbClient client) + public InvoiceService(IOrbClient client) { _client = client; } - public async Tasks::Task Create(Invoices::InvoiceCreateParams @params) + public async Task Create(InvoiceCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Invoices::InvoiceUpdateParams @params) + public async Task Update(InvoiceUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List( - Invoices::InvoiceListParams @params - ) + public async Task List(InvoiceListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(Invoices::InvoiceFetchParams @params) + public async Task Fetch(InvoiceFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task FetchUpcoming( - Invoices::InvoiceFetchUpcomingParams @params + public async Task FetchUpcoming( + InvoiceFetchUpcomingParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Issue(Invoices::InvoiceIssueParams @params) + public async Task Issue(InvoiceIssueParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task MarkPaid(Invoices::InvoiceMarkPaidParams @params) + public async Task MarkPaid(InvoiceMarkPaidParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Pay(Invoices::InvoicePayParams @params) + public async Task Pay(InvoicePayParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Void(Invoices::InvoiceVoidParams @params) + public async Task Void(InvoiceVoidParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Items/IItemService.cs b/src/Orb/Service/Items/IItemService.cs index e4494795..90f80332 100644 --- a/src/Orb/Service/Items/IItemService.cs +++ b/src/Orb/Service/Items/IItemService.cs @@ -1,5 +1,5 @@ -using Items = Orb.Models.Items; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Items; namespace Orb.Service.Items; @@ -8,25 +8,25 @@ public interface IItemService /// /// This endpoint is used to create an [Item](/core-concepts#item). /// - Tasks::Task Create(Items::ItemCreateParams @params); + Task Create(ItemCreateParams @params); /// /// This endpoint can be used to update properties on the Item. /// - Tasks::Task Update(Items::ItemUpdateParams @params); + Task Update(ItemUpdateParams @params); /// /// This endpoint returns a list of all Items, ordered in descending order by creation time. /// - Tasks::Task List(Items::ItemListParams @params); + Task List(ItemListParams @params); /// /// Archive item /// - Tasks::Task Archive(Items::ItemArchiveParams @params); + Task Archive(ItemArchiveParams @params); /// /// This endpoint returns an item identified by its item_id. /// - Tasks::Task Fetch(Items::ItemFetchParams @params); + Task Fetch(ItemFetchParams @params); } diff --git a/src/Orb/Service/Items/ItemService.cs b/src/Orb/Service/Items/ItemService.cs index a22c406b..96eae239 100644 --- a/src/Orb/Service/Items/ItemService.cs +++ b/src/Orb/Service/Items/ItemService.cs @@ -1,114 +1,109 @@ -using Http = System.Net.Http; -using Items = Orb.Models.Items; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Items; namespace Orb.Service.Items; public sealed class ItemService : IItemService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public ItemService(Orb::IOrbClient client) + public ItemService(IOrbClient client) { _client = client; } - public async Tasks::Task Create(Items::ItemCreateParams @params) + public async Task Create(ItemCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Items::ItemUpdateParams @params) + public async Task Update(ItemUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List(Items::ItemListParams @params) + public async Task List(ItemListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Archive(Items::ItemArchiveParams @params) + public async Task Archive(ItemArchiveParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(Items::ItemFetchParams @params) + public async Task Fetch(ItemFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Metrics/IMetricService.cs b/src/Orb/Service/Metrics/IMetricService.cs index bdcbecf7..d1deb4da 100644 --- a/src/Orb/Service/Metrics/IMetricService.cs +++ b/src/Orb/Service/Metrics/IMetricService.cs @@ -1,5 +1,5 @@ -using Metrics = Orb.Models.Metrics; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Metrics; namespace Orb.Service.Metrics; @@ -10,25 +10,25 @@ public interface IMetricService /// SQL string. See [SQL support](/extensibility/advanced-metrics#sql-support) /// for a description of constructing SQL queries with examples. /// - Tasks::Task Create(Metrics::MetricCreateParams @params); + Task Create(MetricCreateParams @params); /// /// This endpoint allows you to update the `metadata` property on a metric. If /// you pass `null` for the metadata value, it will clear any existing metadata /// for that invoice. /// - Tasks::Task Update(Metrics::MetricUpdateParams @params); + Task Update(MetricUpdateParams @params); /// /// This endpoint is used to fetch [metric](/core-concepts##metric) details given /// a metric identifier. It returns information about the metrics including its /// name, description, and item. /// - Tasks::Task List(Metrics::MetricListParams @params); + Task List(MetricListParams @params); /// /// This endpoint is used to list [metrics](/core-concepts#metric). It returns /// information about the metrics including its name, description, and item. /// - Tasks::Task Fetch(Metrics::MetricFetchParams @params); + Task Fetch(MetricFetchParams @params); } diff --git a/src/Orb/Service/Metrics/MetricService.cs b/src/Orb/Service/Metrics/MetricService.cs index dcb3404e..61bed241 100644 --- a/src/Orb/Service/Metrics/MetricService.cs +++ b/src/Orb/Service/Metrics/MetricService.cs @@ -1,98 +1,95 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Metrics = Orb.Models.Metrics; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Metrics; namespace Orb.Service.Metrics; public sealed class MetricService : IMetricService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public MetricService(Orb::IOrbClient client) + public MetricService(IOrbClient client) { _client = client; } - public async Tasks::Task Create(Metrics::MetricCreateParams @params) + public async Task Create(MetricCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Metrics::MetricUpdateParams @params) + public async Task Update(MetricUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task List( - Metrics::MetricListParams @params - ) + public async Task List(MetricListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(Metrics::MetricFetchParams @params) + public async Task Fetch(MetricFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Plans/ExternalPlanID/ExternalPlanIDService.cs b/src/Orb/Service/Plans/ExternalPlanID/ExternalPlanIDService.cs index 721929fa..b15fa61d 100644 --- a/src/Orb/Service/Plans/ExternalPlanID/ExternalPlanIDService.cs +++ b/src/Orb/Service/Plans/ExternalPlanID/ExternalPlanIDService.cs @@ -1,58 +1,55 @@ -using ExternalPlanID = Orb.Models.Plans.ExternalPlanID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using Plans = Orb.Models.Plans; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Plans; +using Orb.Models.Plans.ExternalPlanID; namespace Orb.Service.Plans.ExternalPlanID; public sealed class ExternalPlanIDService : IExternalPlanIDService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public ExternalPlanIDService(Orb::IOrbClient client) + public ExternalPlanIDService(IOrbClient client) { _client = client; } - public async Tasks::Task Update(ExternalPlanID::ExternalPlanIDUpdateParams @params) + public async Task Update(ExternalPlanIDUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(ExternalPlanID::ExternalPlanIDFetchParams @params) + public async Task Fetch(ExternalPlanIDFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Plans/ExternalPlanID/IExternalPlanIDService.cs b/src/Orb/Service/Plans/ExternalPlanID/IExternalPlanIDService.cs index 84811bba..c467c3d0 100644 --- a/src/Orb/Service/Plans/ExternalPlanID/IExternalPlanIDService.cs +++ b/src/Orb/Service/Plans/ExternalPlanID/IExternalPlanIDService.cs @@ -1,6 +1,6 @@ -using ExternalPlanID = Orb.Models.Plans.ExternalPlanID; -using Plans = Orb.Models.Plans; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.Plans; +using Orb.Models.Plans.ExternalPlanID; namespace Orb.Service.Plans.ExternalPlanID; @@ -12,7 +12,7 @@ public interface IExternalPlanIDService /// /// Other fields on a plan are currently immutable. /// - Tasks::Task Update(ExternalPlanID::ExternalPlanIDUpdateParams @params); + Task Update(ExternalPlanIDUpdateParams @params); /// /// This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details @@ -30,5 +30,5 @@ public interface IExternalPlanIDService /// that is present. A detailed explanation of price types can be found in the [Price /// schema](/core-concepts#plan-and-price). " /// - Tasks::Task Fetch(ExternalPlanID::ExternalPlanIDFetchParams @params); + Task Fetch(ExternalPlanIDFetchParams @params); } diff --git a/src/Orb/Service/Plans/IPlanService.cs b/src/Orb/Service/Plans/IPlanService.cs index 85824dc7..5284656e 100644 --- a/src/Orb/Service/Plans/IPlanService.cs +++ b/src/Orb/Service/Plans/IPlanService.cs @@ -1,6 +1,6 @@ +using System.Threading.Tasks; +using Orb.Models.Plans; using ExternalPlanID = Orb.Service.Plans.ExternalPlanID; -using Plans = Orb.Models.Plans; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Plans; @@ -11,7 +11,7 @@ public interface IPlanService /// /// This endpoint allows creation of plans including their prices. /// - Tasks::Task Create(Plans::PlanCreateParams @params); + Task Create(PlanCreateParams @params); /// /// This endpoint can be used to update the `external_plan_id`, and `metadata` @@ -19,7 +19,7 @@ public interface IPlanService /// /// Other fields on a plan are currently immutable. /// - Tasks::Task Update(Plans::PlanUpdateParams @params); + Task Update(PlanUpdateParams @params); /// /// This endpoint returns a list of all [plans](/core-concepts#plan-and-price) for @@ -27,7 +27,7 @@ public interface IPlanService /// most recently created plan. The response also includes [`pagination_metadata`](/api-reference/pagination), /// which lets the caller retrieve the next page of results if they exist. /// - Tasks::Task List(Plans::PlanListParams @params); + Task List(PlanListParams @params); /// /// This endpoint is used to fetch [plan](/core-concepts#plan-and-price) details @@ -42,5 +42,5 @@ public interface IPlanService /// ## Phases Orb supports plan phases, also known as contract ramps. For plans /// with phases, the serialized prices refer to all prices across all phases. /// - Tasks::Task Fetch(Plans::PlanFetchParams @params); + Task Fetch(PlanFetchParams @params); } diff --git a/src/Orb/Service/Plans/PlanService.cs b/src/Orb/Service/Plans/PlanService.cs index d56a4fd6..340fc518 100644 --- a/src/Orb/Service/Plans/PlanService.cs +++ b/src/Orb/Service/Plans/PlanService.cs @@ -1,104 +1,100 @@ +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.Plans; using ExternalPlanID = Orb.Service.Plans.ExternalPlanID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using Plans = Orb.Models.Plans; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Plans; public sealed class PlanService : IPlanService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public PlanService(Orb::IOrbClient client) + public PlanService(IOrbClient client) { _client = client; _externalPlanID = new(() => new ExternalPlanID::ExternalPlanIDService(client)); } - readonly System::Lazy _externalPlanID; + readonly Lazy _externalPlanID; public ExternalPlanID::IExternalPlanIDService ExternalPlanID { get { return _externalPlanID.Value; } } - public async Tasks::Task Create(Plans::PlanCreateParams @params) + public async Task Create(PlanCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Plans::PlanUpdateParams @params) + public async Task Update(PlanUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List(Plans::PlanListParams @params) + public async Task List(PlanListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(Plans::PlanFetchParams @params) + public async Task Fetch(PlanFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Prices/ExternalPriceID/ExternalPriceIDService.cs b/src/Orb/Service/Prices/ExternalPriceID/ExternalPriceIDService.cs index 1fb3a817..aa64bb7b 100644 --- a/src/Orb/Service/Prices/ExternalPriceID/ExternalPriceIDService.cs +++ b/src/Orb/Service/Prices/ExternalPriceID/ExternalPriceIDService.cs @@ -1,62 +1,55 @@ -using ExternalPriceID = Orb.Models.Prices.ExternalPriceID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Prices.ExternalPriceID; namespace Orb.Service.Prices.ExternalPriceID; public sealed class ExternalPriceIDService : IExternalPriceIDService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public ExternalPriceIDService(Orb::IOrbClient client) + public ExternalPriceIDService(IOrbClient client) { _client = client; } - public async Tasks::Task Update( - ExternalPriceID::ExternalPriceIDUpdateParams @params - ) + public async Task Update(ExternalPriceIDUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch( - ExternalPriceID::ExternalPriceIDFetchParams @params - ) + public async Task Fetch(ExternalPriceIDFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Prices/ExternalPriceID/IExternalPriceIDService.cs b/src/Orb/Service/Prices/ExternalPriceID/IExternalPriceIDService.cs index 9b684a2c..782c7be4 100644 --- a/src/Orb/Service/Prices/ExternalPriceID/IExternalPriceIDService.cs +++ b/src/Orb/Service/Prices/ExternalPriceID/IExternalPriceIDService.cs @@ -1,6 +1,6 @@ -using ExternalPriceID = Orb.Models.Prices.ExternalPriceID; -using Models = Orb.Models; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Prices.ExternalPriceID; namespace Orb.Service.Prices.ExternalPriceID; @@ -10,12 +10,12 @@ public interface IExternalPriceIDService /// This endpoint allows you to update the `metadata` property on a price. If you /// pass null for the metadata value, it will clear any existing metadata for that price. /// - Tasks::Task Update(ExternalPriceID::ExternalPriceIDUpdateParams @params); + Task Update(ExternalPriceIDUpdateParams @params); /// /// This endpoint returns a price given an external price id. See the [price creation /// API](/api-reference/price/create-price) for more information about external /// price aliases. /// - Tasks::Task Fetch(ExternalPriceID::ExternalPriceIDFetchParams @params); + Task Fetch(ExternalPriceIDFetchParams @params); } diff --git a/src/Orb/Service/Prices/IPriceService.cs b/src/Orb/Service/Prices/IPriceService.cs index 197174f6..0f431ed9 100644 --- a/src/Orb/Service/Prices/IPriceService.cs +++ b/src/Orb/Service/Prices/IPriceService.cs @@ -1,7 +1,7 @@ +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Prices; using ExternalPriceID = Orb.Service.Prices.ExternalPriceID; -using Models = Orb.Models; -using Prices = Orb.Models.Prices; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Prices; @@ -21,18 +21,18 @@ public interface IPriceService /// See the [Price resource](/product-catalog/price-configuration) for the specification /// of different price model configurations possible in this endpoint. /// - Tasks::Task Create(Prices::PriceCreateParams @params); + Task Create(PriceCreateParams @params); /// /// This endpoint allows you to update the `metadata` property on a price. If you /// pass null for the metadata value, it will clear any existing metadata for that price. /// - Tasks::Task Update(Prices::PriceUpdateParams @params); + Task Update(PriceUpdateParams @params); /// /// This endpoint is used to list all add-on prices created using the [price creation endpoint](/api-reference/price/create-price). /// - Tasks::Task List(Prices::PriceListParams @params); + Task List(PriceListParams @params); /// /// [NOTE] It is recommended to use the `/v1/prices/evaluate` which offers further @@ -60,7 +60,7 @@ public interface IPriceService /// POST endpoint rather than a GET endpoint because it employs a JSON body rather /// than query parameters. /// - Tasks::Task Evaluate(Prices::PriceEvaluateParams @params); + Task Evaluate(PriceEvaluateParams @params); /// /// This endpoint is used to evaluate the output of price(s) for a given customer @@ -90,9 +90,7 @@ public interface IPriceService /// Note that this is a POST endpoint rather than a GET endpoint because it employs /// a JSON body rather than query parameters. /// - Tasks::Task EvaluateMultiple( - Prices::PriceEvaluateMultipleParams @params - ); + Task EvaluateMultiple(PriceEvaluateMultipleParams @params); /// /// This endpoint evaluates prices on preview events instead of actual usage, making @@ -111,12 +109,12 @@ public interface IPriceService /// Note that this is a POST endpoint rather than a GET endpoint because it employs /// a JSON body rather than query parameters. /// - Tasks::Task EvaluatePreviewEvents( - Prices::PriceEvaluatePreviewEventsParams @params + Task EvaluatePreviewEvents( + PriceEvaluatePreviewEventsParams @params ); /// /// This endpoint returns a price given an identifier. /// - Tasks::Task Fetch(Prices::PriceFetchParams @params); + Task Fetch(PriceFetchParams @params); } diff --git a/src/Orb/Service/Prices/PriceService.cs b/src/Orb/Service/Prices/PriceService.cs index a8905581..72a1f41f 100644 --- a/src/Orb/Service/Prices/PriceService.cs +++ b/src/Orb/Service/Prices/PriceService.cs @@ -1,174 +1,168 @@ +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models; +using Orb.Models.Prices; using ExternalPriceID = Orb.Service.Prices.ExternalPriceID; -using Http = System.Net.Http; -using Json = System.Text.Json; -using Models = Orb.Models; -using Orb = Orb; -using Prices = Orb.Models.Prices; -using System = System; -using Tasks = System.Threading.Tasks; namespace Orb.Service.Prices; public sealed class PriceService : IPriceService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public PriceService(Orb::IOrbClient client) + public PriceService(IOrbClient client) { _client = client; _externalPriceID = new(() => new ExternalPriceID::ExternalPriceIDService(client)); } - readonly System::Lazy _externalPriceID; + readonly Lazy _externalPriceID; public ExternalPriceID::IExternalPriceIDService ExternalPriceID { get { return _externalPriceID.Value; } } - public async Tasks::Task Create(Prices::PriceCreateParams @params) + public async Task Create(PriceCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Update(Prices::PriceUpdateParams @params) + public async Task Update(PriceUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List(Prices::PriceListParams @params) + public async Task List(PriceListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Evaluate( - Prices::PriceEvaluateParams @params - ) + public async Task Evaluate(PriceEvaluateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task EvaluateMultiple( - Prices::PriceEvaluateMultipleParams @params + public async Task EvaluateMultiple( + PriceEvaluateMultipleParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task EvaluatePreviewEvents( - Prices::PriceEvaluatePreviewEventsParams @params + public async Task EvaluatePreviewEvents( + PriceEvaluatePreviewEventsParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch(Prices::PriceFetchParams @params) + public async Task Fetch(PriceFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/SubscriptionChanges/ISubscriptionChangeService.cs b/src/Orb/Service/SubscriptionChanges/ISubscriptionChangeService.cs index 4aa31d0c..cc1c1e0c 100644 --- a/src/Orb/Service/SubscriptionChanges/ISubscriptionChangeService.cs +++ b/src/Orb/Service/SubscriptionChanges/ISubscriptionChangeService.cs @@ -1,5 +1,5 @@ -using SubscriptionChanges = Orb.Models.SubscriptionChanges; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.SubscriptionChanges; namespace Orb.Service.SubscriptionChanges; @@ -14,25 +14,19 @@ public interface ISubscriptionChangeService /// endpoint](/api-reference/subscription/schedule-plan-change), ...). The subscription /// change will be referenced by the `pending_subscription_change` field in the response. /// - Tasks::Task Retrieve( - SubscriptionChanges::SubscriptionChangeRetrieveParams @params - ); + Task Retrieve(SubscriptionChangeRetrieveParams @params); /// /// Apply a subscription change to perform the intended action. If a positive amount /// is passed with a request to this endpoint, any eligible invoices that were created /// will be issued immediately if they only contain in-advance fees. /// - Tasks::Task Apply( - SubscriptionChanges::SubscriptionChangeApplyParams @params - ); + Task Apply(SubscriptionChangeApplyParams @params); /// /// Cancel a subscription change. The change can no longer be applied. A subscription /// can only have one "pending" change at a time - use this endpoint to cancel an /// existing change before creating a new one. /// - Tasks::Task Cancel( - SubscriptionChanges::SubscriptionChangeCancelParams @params - ); + Task Cancel(SubscriptionChangeCancelParams @params); } diff --git a/src/Orb/Service/SubscriptionChanges/SubscriptionChangeService.cs b/src/Orb/Service/SubscriptionChanges/SubscriptionChangeService.cs index 0cbfee12..095e892e 100644 --- a/src/Orb/Service/SubscriptionChanges/SubscriptionChangeService.cs +++ b/src/Orb/Service/SubscriptionChanges/SubscriptionChangeService.cs @@ -1,81 +1,78 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using SubscriptionChanges = Orb.Models.SubscriptionChanges; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.SubscriptionChanges; namespace Orb.Service.SubscriptionChanges; public sealed class SubscriptionChangeService : ISubscriptionChangeService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public SubscriptionChangeService(Orb::IOrbClient client) + public SubscriptionChangeService(IOrbClient client) { _client = client; } - public async Tasks::Task Retrieve( - SubscriptionChanges::SubscriptionChangeRetrieveParams @params + public async Task Retrieve( + SubscriptionChangeRetrieveParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Apply( - SubscriptionChanges::SubscriptionChangeApplyParams @params - ) + public async Task Apply(SubscriptionChangeApplyParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Cancel( - SubscriptionChanges::SubscriptionChangeCancelParams @params + public async Task Cancel( + SubscriptionChangeCancelParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/Subscriptions/ISubscriptionService.cs b/src/Orb/Service/Subscriptions/ISubscriptionService.cs index c31cabf2..b5fe8829 100644 --- a/src/Orb/Service/Subscriptions/ISubscriptionService.cs +++ b/src/Orb/Service/Subscriptions/ISubscriptionService.cs @@ -1,6 +1,6 @@ -using SubscriptionChanges = Orb.Models.SubscriptionChanges; -using Subscriptions = Orb.Models.Subscriptions; -using Tasks = System.Threading.Tasks; +using System.Threading.Tasks; +using Orb.Models.SubscriptionChanges; +using Orb.Models.Subscriptions; namespace Orb.Service.Subscriptions; @@ -196,17 +196,13 @@ public interface ISubscriptionService /// E.g. pass in `10.00` to issue an invoice when usage amounts hit \$10.00 for /// a subscription that invoices in USD. /// - Tasks::Task Create( - Subscriptions::SubscriptionCreateParams @params - ); + Task Create(SubscriptionCreateParams @params); /// /// This endpoint can be used to update the `metadata`, `net terms`, `auto_collection`, /// `invoicing_threshold`, and `default_invoice_memo` properties on a subscription. /// - Tasks::Task Update( - Subscriptions::SubscriptionUpdateParams @params - ); + Task Update(SubscriptionUpdateParams @params); /// /// This endpoint returns a list of all subscriptions for an account as a [paginated](/api-reference/pagination) @@ -217,7 +213,7 @@ public interface ISubscriptionService /// or external_customer_id query parameters. To filter subscriptions for multiple /// customers, use the customer_id[] or external_customer_id[] query parameters. /// - Tasks::Task List(Subscriptions::SubscriptionListParams @params); + Task List(SubscriptionListParams @params); /// /// This endpoint can be used to cancel an existing subscription. It returns the @@ -272,15 +268,13 @@ public interface ISubscriptionService /// most recently issued invoice, Orb will void the intervening invoice and generate /// a new one based on the new dates for the subscription. See the section on [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors). /// - Tasks::Task Cancel( - Subscriptions::SubscriptionCancelParams @params - ); + Task Cancel(SubscriptionCancelParams @params); /// /// This endpoint is used to fetch a [Subscription](/core-concepts##subscription) /// given an identifier. /// - Tasks::Task Fetch(Subscriptions::SubscriptionFetchParams @params); + Task Fetch(SubscriptionFetchParams @params); /// /// This endpoint is used to fetch a day-by-day snapshot of a subscription's costs @@ -293,17 +287,15 @@ public interface ISubscriptionService /// to a specific subscription for the customer (e.g. to de-aggregate costs when /// a customer's subscription has started and stopped on the same day). /// - Tasks::Task FetchCosts( - Subscriptions::SubscriptionFetchCostsParams @params - ); + Task FetchCosts(SubscriptionFetchCostsParams @params); /// /// This endpoint returns a [paginated](/api-reference/pagination) list of all plans /// associated with a subscription along with their start and end dates. This list /// contains the subscription's initial plan along with past and future plan changes. /// - Tasks::Task FetchSchedule( - Subscriptions::SubscriptionFetchScheduleParams @params + Task FetchSchedule( + SubscriptionFetchScheduleParams @params ); /// @@ -436,9 +428,7 @@ public interface ISubscriptionService /// - `first_dimension_key`: `region` - `first_dimension_value`: `us-east-1` - /// `second_dimension_key`: `provider` - `second_dimension_value`: `aws` /// - Tasks::Task FetchUsage( - Subscriptions::SubscriptionFetchUsageParams @params - ); + Task FetchUsage(SubscriptionFetchUsageParams @params); /// /// This endpoint is used to add and edit subscription [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). @@ -510,16 +500,12 @@ public interface ISubscriptionService /// list of transitions can be retrieved using the `fixed_fee_quantity_transitions` /// property on a subscription’s serialized price intervals. /// - Tasks::Task PriceIntervals( - Subscriptions::SubscriptionPriceIntervalsParams @params - ); + Task PriceIntervals(SubscriptionPriceIntervalsParams @params); /// /// Redeem a coupon effective at a given time. /// - Tasks::Task RedeemCoupon( - Subscriptions::SubscriptionRedeemCouponParams @params - ); + Task RedeemCoupon(SubscriptionRedeemCouponParams @params); /// /// This endpoint can be used to change an existing subscription's plan. It returns @@ -679,17 +665,13 @@ public interface ISubscriptionService /// in any fixed fees when making a plan change, adjusting the customer balance /// as needed. For details on this behavior, see [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees). /// - Tasks::Task SchedulePlanChange( - Subscriptions::SubscriptionSchedulePlanChangeParams @params - ); + Task SchedulePlanChange(SubscriptionSchedulePlanChangeParams @params); /// /// Manually trigger a phase, effective the given date (or the current time, if /// not specified). /// - Tasks::Task TriggerPhase( - Subscriptions::SubscriptionTriggerPhaseParams @params - ); + Task TriggerPhase(SubscriptionTriggerPhaseParams @params); /// /// This endpoint can be used to unschedule any pending cancellations for a subscription. @@ -698,8 +680,8 @@ public interface ISubscriptionService /// cancellation. This operation will turn on auto-renew, ensuring that the subscription /// does not end at the currently scheduled cancellation time. /// - Tasks::Task UnscheduleCancellation( - Subscriptions::SubscriptionUnscheduleCancellationParams @params + Task UnscheduleCancellation( + SubscriptionUnscheduleCancellationParams @params ); /// @@ -708,16 +690,16 @@ public interface ISubscriptionService /// If there are no updates scheduled, a request validation error will be returned /// with a 400 status code. /// - Tasks::Task UnscheduleFixedFeeQuantityUpdates( - Subscriptions::SubscriptionUnscheduleFixedFeeQuantityUpdatesParams @params + Task UnscheduleFixedFeeQuantityUpdates( + SubscriptionUnscheduleFixedFeeQuantityUpdatesParams @params ); /// /// This endpoint can be used to unschedule any pending plan changes on an existing /// subscription. When called, all upcoming plan changes will be unscheduled. /// - Tasks::Task UnschedulePendingPlanChanges( - Subscriptions::SubscriptionUnschedulePendingPlanChangesParams @params + Task UnschedulePendingPlanChanges( + SubscriptionUnschedulePendingPlanChangesParams @params ); /// @@ -734,8 +716,8 @@ public interface ISubscriptionService /// If the fee is an in-advance fixed fee, it will also issue an immediate invoice /// for the difference for the remainder of the billing period. /// - Tasks::Task UpdateFixedFeeQuantity( - Subscriptions::SubscriptionUpdateFixedFeeQuantityParams @params + Task UpdateFixedFeeQuantity( + SubscriptionUpdateFixedFeeQuantityParams @params ); /// @@ -758,7 +740,5 @@ public interface ISubscriptionService /// added, that change will be pushed back by the same amount of time the trial /// is extended). /// - Tasks::Task UpdateTrial( - Subscriptions::SubscriptionUpdateTrialParams @params - ); + Task UpdateTrial(SubscriptionUpdateTrialParams @params); } diff --git a/src/Orb/Service/Subscriptions/SubscriptionService.cs b/src/Orb/Service/Subscriptions/SubscriptionService.cs index 8f2c6ae3..480c2865 100644 --- a/src/Orb/Service/Subscriptions/SubscriptionService.cs +++ b/src/Orb/Service/Subscriptions/SubscriptionService.cs @@ -1,389 +1,365 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using SubscriptionChanges = Orb.Models.SubscriptionChanges; -using Subscriptions = Orb.Models.Subscriptions; -using System = System; -using Tasks = System.Threading.Tasks; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.SubscriptionChanges; +using Orb.Models.Subscriptions; namespace Orb.Service.Subscriptions; public sealed class SubscriptionService : ISubscriptionService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public SubscriptionService(Orb::IOrbClient client) + public SubscriptionService(IOrbClient client) { _client = client; } - public async Tasks::Task Create( - Subscriptions::SubscriptionCreateParams @params - ) + public async Task Create(SubscriptionCreateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Update( - Subscriptions::SubscriptionUpdateParams @params - ) + public async Task Update(SubscriptionUpdateParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Put, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Put, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task List( - Subscriptions::SubscriptionListParams @params - ) + public async Task List(SubscriptionListParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task Cancel( - Subscriptions::SubscriptionCancelParams @params - ) + public async Task Cancel(SubscriptionCancelParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task Fetch( - Subscriptions::SubscriptionFetchParams @params - ) + public async Task Fetch(SubscriptionFetchParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( - await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + return JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()) + ?? throw new NullReferenceException(); } - public async Tasks::Task FetchCosts( - Subscriptions::SubscriptionFetchCostsParams @params + public async Task FetchCosts( + SubscriptionFetchCostsParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task FetchSchedule( - Subscriptions::SubscriptionFetchScheduleParams @params + public async Task FetchSchedule( + SubscriptionFetchScheduleParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task FetchUsage( - Subscriptions::SubscriptionFetchUsageParams @params - ) + public async Task FetchUsage(SubscriptionFetchUsageParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task PriceIntervals( - Subscriptions::SubscriptionPriceIntervalsParams @params - ) + public async Task PriceIntervals(SubscriptionPriceIntervalsParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task RedeemCoupon( - Subscriptions::SubscriptionRedeemCouponParams @params - ) + public async Task RedeemCoupon(SubscriptionRedeemCouponParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task SchedulePlanChange( - Subscriptions::SubscriptionSchedulePlanChangeParams @params + public async Task SchedulePlanChange( + SubscriptionSchedulePlanChangeParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task TriggerPhase( - Subscriptions::SubscriptionTriggerPhaseParams @params - ) + public async Task TriggerPhase(SubscriptionTriggerPhaseParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task UnscheduleCancellation( - Subscriptions::SubscriptionUnscheduleCancellationParams @params + public async Task UnscheduleCancellation( + SubscriptionUnscheduleCancellationParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task UnscheduleFixedFeeQuantityUpdates( - Subscriptions::SubscriptionUnscheduleFixedFeeQuantityUpdatesParams @params + public async Task UnscheduleFixedFeeQuantityUpdates( + SubscriptionUnscheduleFixedFeeQuantityUpdatesParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task UnschedulePendingPlanChanges( - Subscriptions::SubscriptionUnschedulePendingPlanChangesParams @params + public async Task UnschedulePendingPlanChanges( + SubscriptionUnschedulePendingPlanChangesParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task UpdateFixedFeeQuantity( - Subscriptions::SubscriptionUpdateFixedFeeQuantityParams @params + public async Task UpdateFixedFeeQuantity( + SubscriptionUpdateFixedFeeQuantityParams @params ) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } - public async Tasks::Task UpdateTrial( - Subscriptions::SubscriptionUpdateTrialParams @params - ) + public async Task UpdateTrial(SubscriptionUpdateTrialParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Post, @params.Url(this._client)) + HttpRequestMessage webRequest = new(HttpMethod.Post, @params.Url(this._client)) { Content = @params.BodyContent(), }; @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } } diff --git a/src/Orb/Service/TopLevel/ITopLevelService.cs b/src/Orb/Service/TopLevel/ITopLevelService.cs index d175634c..b62e3df5 100644 --- a/src/Orb/Service/TopLevel/ITopLevelService.cs +++ b/src/Orb/Service/TopLevel/ITopLevelService.cs @@ -1,5 +1,5 @@ -using Tasks = System.Threading.Tasks; -using TopLevel = Orb.Models.TopLevel; +using System.Threading.Tasks; +using Orb.Models.TopLevel; namespace Orb.Service.TopLevel; @@ -13,5 +13,5 @@ public interface ITopLevelService /// /// This API does not have any side-effects or return any Orb resources. /// - Tasks::Task Ping(TopLevel::TopLevelPingParams @params); + Task Ping(TopLevelPingParams @params); } diff --git a/src/Orb/Service/TopLevel/TopLevelService.cs b/src/Orb/Service/TopLevel/TopLevelService.cs index f42cd9ec..83cda5bc 100644 --- a/src/Orb/Service/TopLevel/TopLevelService.cs +++ b/src/Orb/Service/TopLevel/TopLevelService.cs @@ -1,38 +1,35 @@ -using Http = System.Net.Http; -using Json = System.Text.Json; -using Orb = Orb; -using System = System; -using Tasks = System.Threading.Tasks; -using TopLevel = Orb.Models.TopLevel; +using System; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Orb.Models.TopLevel; namespace Orb.Service.TopLevel; public sealed class TopLevelService : ITopLevelService { - readonly Orb::IOrbClient _client; + readonly IOrbClient _client; - public TopLevelService(Orb::IOrbClient client) + public TopLevelService(IOrbClient client) { _client = client; } - public async Tasks::Task Ping( - TopLevel::TopLevelPingParams @params - ) + public async Task Ping(TopLevelPingParams @params) { - Http::HttpRequestMessage webRequest = new(Http::HttpMethod.Get, @params.Url(this._client)); + HttpRequestMessage webRequest = new(HttpMethod.Get, @params.Url(this._client)); @params.AddHeadersToRequest(webRequest, this._client); - using Http::HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); + using HttpResponseMessage response = await _client.HttpClient.SendAsync(webRequest); try { response.EnsureSuccessStatusCode(); } - catch (Http::HttpRequestException e) + catch (HttpRequestException e) { - throw new Orb::HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); + throw new HttpException(e.StatusCode, await response.Content.ReadAsStringAsync()); } - return Json::JsonSerializer.Deserialize( + return JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() - ) ?? throw new System::NullReferenceException(); + ) ?? throw new NullReferenceException(); } }