Skip to content

Commit e3ba15d

Browse files
chore(client): improve union validation
1 parent 4758f8b commit e3ba15d

File tree

110 files changed

+964
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+964
-0
lines changed

src/Orb/Models/AdjustmentInterval.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,13 @@ public void Validate()
460460
{
461461
throw new OrbInvalidDataException("Data did not match any variant of Adjustment");
462462
}
463+
this.Switch(
464+
(planPhaseUsageDiscount) => planPhaseUsageDiscount.Validate(),
465+
(planPhaseAmountDiscount) => planPhaseAmountDiscount.Validate(),
466+
(planPhasePercentageDiscount) => planPhasePercentageDiscount.Validate(),
467+
(planPhaseMinimum) => planPhaseMinimum.Validate(),
468+
(planPhaseMaximum) => planPhaseMaximum.Validate()
469+
);
463470
}
464471

465472
public virtual bool Equals(Adjustment? other)

src/Orb/Models/Beta/BetaCreatePlanVersionParams.cs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,13 @@ public void Validate()
580580
{
581581
throw new OrbInvalidDataException("Data did not match any variant of Adjustment");
582582
}
583+
this.Switch(
584+
(newPercentageDiscount) => newPercentageDiscount.Validate(),
585+
(newUsageDiscount) => newUsageDiscount.Validate(),
586+
(newAmountDiscount) => newAmountDiscount.Validate(),
587+
(newMinimum) => newMinimum.Validate(),
588+
(newMaximum) => newMaximum.Validate()
589+
);
583590
}
584591

585592
public virtual bool Equals(global::Orb.Models.Beta.Adjustment? other)
@@ -2696,6 +2703,41 @@ public void Validate()
26962703
{
26972704
throw new OrbInvalidDataException("Data did not match any variant of Price");
26982705
}
2706+
this.Switch(
2707+
(newPlanUnit) => newPlanUnit.Validate(),
2708+
(newPlanTiered) => newPlanTiered.Validate(),
2709+
(newPlanBulk) => newPlanBulk.Validate(),
2710+
(bulkWithFilters) => bulkWithFilters.Validate(),
2711+
(newPlanPackage) => newPlanPackage.Validate(),
2712+
(newPlanMatrix) => newPlanMatrix.Validate(),
2713+
(newPlanThresholdTotalAmount) => newPlanThresholdTotalAmount.Validate(),
2714+
(newPlanTieredPackage) => newPlanTieredPackage.Validate(),
2715+
(newPlanTieredWithMinimum) => newPlanTieredWithMinimum.Validate(),
2716+
(newPlanGroupedTiered) => newPlanGroupedTiered.Validate(),
2717+
(newPlanTieredPackageWithMinimum) => newPlanTieredPackageWithMinimum.Validate(),
2718+
(newPlanPackageWithAllocation) => newPlanPackageWithAllocation.Validate(),
2719+
(newPlanUnitWithPercent) => newPlanUnitWithPercent.Validate(),
2720+
(newPlanMatrixWithAllocation) => newPlanMatrixWithAllocation.Validate(),
2721+
(tieredWithProration) => tieredWithProration.Validate(),
2722+
(newPlanUnitWithProration) => newPlanUnitWithProration.Validate(),
2723+
(newPlanGroupedAllocation) => newPlanGroupedAllocation.Validate(),
2724+
(newPlanBulkWithProration) => newPlanBulkWithProration.Validate(),
2725+
(newPlanGroupedWithProratedMinimum) => newPlanGroupedWithProratedMinimum.Validate(),
2726+
(newPlanGroupedWithMeteredMinimum) => newPlanGroupedWithMeteredMinimum.Validate(),
2727+
(groupedWithMinMaxThresholds) => groupedWithMinMaxThresholds.Validate(),
2728+
(newPlanMatrixWithDisplayName) => newPlanMatrixWithDisplayName.Validate(),
2729+
(newPlanGroupedTieredPackage) => newPlanGroupedTieredPackage.Validate(),
2730+
(newPlanMaxGroupTieredPackage) => newPlanMaxGroupTieredPackage.Validate(),
2731+
(newPlanScalableMatrixWithUnitPricing) =>
2732+
newPlanScalableMatrixWithUnitPricing.Validate(),
2733+
(newPlanScalableMatrixWithTieredPricing) =>
2734+
newPlanScalableMatrixWithTieredPricing.Validate(),
2735+
(newPlanCumulativeGroupedBulk) => newPlanCumulativeGroupedBulk.Validate(),
2736+
(cumulativeGroupedAllocation) => cumulativeGroupedAllocation.Validate(),
2737+
(newPlanMinimumComposite) => newPlanMinimumComposite.Validate(),
2738+
(percent) => percent.Validate(),
2739+
(eventOutput) => eventOutput.Validate()
2740+
);
26992741
}
27002742

27012743
public virtual bool Equals(global::Orb.Models.Beta.Price? other)
@@ -4193,6 +4235,7 @@ public void Validate()
41934235
"Data did not match any variant of ConversionRateConfig"
41944236
);
41954237
}
4238+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
41964239
}
41974240

41984241
public virtual bool Equals(global::Orb.Models.Beta.ConversionRateConfig? other)
@@ -4972,6 +5015,7 @@ public void Validate()
49725015
"Data did not match any variant of TieredWithProrationConversionRateConfig"
49735016
);
49745017
}
5018+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
49755019
}
49765020

49775021
public virtual bool Equals(
@@ -5705,6 +5749,7 @@ public void Validate()
57055749
"Data did not match any variant of GroupedWithMinMaxThresholdsConversionRateConfig"
57065750
);
57075751
}
5752+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
57085753
}
57095754

57105755
public virtual bool Equals(
@@ -6440,6 +6485,7 @@ public void Validate()
64406485
"Data did not match any variant of CumulativeGroupedAllocationConversionRateConfig"
64416486
);
64426487
}
6488+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
64436489
}
64446490

64456491
public virtual bool Equals(
@@ -7132,6 +7178,7 @@ public void Validate()
71327178
"Data did not match any variant of PercentConversionRateConfig"
71337179
);
71347180
}
7181+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
71357182
}
71367183

71377184
public virtual bool Equals(global::Orb.Models.Beta.PercentConversionRateConfig? other)
@@ -7846,6 +7893,7 @@ public void Validate()
78467893
"Data did not match any variant of EventOutputConversionRateConfig"
78477894
);
78487895
}
7896+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
78497897
}
78507898

78517899
public virtual bool Equals(global::Orb.Models.Beta.EventOutputConversionRateConfig? other)
@@ -8470,6 +8518,13 @@ public void Validate()
84708518
"Data did not match any variant of ReplaceAdjustmentAdjustment"
84718519
);
84728520
}
8521+
this.Switch(
8522+
(newPercentageDiscount) => newPercentageDiscount.Validate(),
8523+
(newUsageDiscount) => newUsageDiscount.Validate(),
8524+
(newAmountDiscount) => newAmountDiscount.Validate(),
8525+
(newMinimum) => newMinimum.Validate(),
8526+
(newMaximum) => newMaximum.Validate()
8527+
);
84738528
}
84748529

84758530
public virtual bool Equals(ReplaceAdjustmentAdjustment? other)
@@ -10580,6 +10635,41 @@ public void Validate()
1058010635
"Data did not match any variant of ReplacePricePrice"
1058110636
);
1058210637
}
10638+
this.Switch(
10639+
(newPlanUnit) => newPlanUnit.Validate(),
10640+
(newPlanTiered) => newPlanTiered.Validate(),
10641+
(newPlanBulk) => newPlanBulk.Validate(),
10642+
(bulkWithFilters) => bulkWithFilters.Validate(),
10643+
(newPlanPackage) => newPlanPackage.Validate(),
10644+
(newPlanMatrix) => newPlanMatrix.Validate(),
10645+
(newPlanThresholdTotalAmount) => newPlanThresholdTotalAmount.Validate(),
10646+
(newPlanTieredPackage) => newPlanTieredPackage.Validate(),
10647+
(newPlanTieredWithMinimum) => newPlanTieredWithMinimum.Validate(),
10648+
(newPlanGroupedTiered) => newPlanGroupedTiered.Validate(),
10649+
(newPlanTieredPackageWithMinimum) => newPlanTieredPackageWithMinimum.Validate(),
10650+
(newPlanPackageWithAllocation) => newPlanPackageWithAllocation.Validate(),
10651+
(newPlanUnitWithPercent) => newPlanUnitWithPercent.Validate(),
10652+
(newPlanMatrixWithAllocation) => newPlanMatrixWithAllocation.Validate(),
10653+
(tieredWithProration) => tieredWithProration.Validate(),
10654+
(newPlanUnitWithProration) => newPlanUnitWithProration.Validate(),
10655+
(newPlanGroupedAllocation) => newPlanGroupedAllocation.Validate(),
10656+
(newPlanBulkWithProration) => newPlanBulkWithProration.Validate(),
10657+
(newPlanGroupedWithProratedMinimum) => newPlanGroupedWithProratedMinimum.Validate(),
10658+
(newPlanGroupedWithMeteredMinimum) => newPlanGroupedWithMeteredMinimum.Validate(),
10659+
(groupedWithMinMaxThresholds) => groupedWithMinMaxThresholds.Validate(),
10660+
(newPlanMatrixWithDisplayName) => newPlanMatrixWithDisplayName.Validate(),
10661+
(newPlanGroupedTieredPackage) => newPlanGroupedTieredPackage.Validate(),
10662+
(newPlanMaxGroupTieredPackage) => newPlanMaxGroupTieredPackage.Validate(),
10663+
(newPlanScalableMatrixWithUnitPricing) =>
10664+
newPlanScalableMatrixWithUnitPricing.Validate(),
10665+
(newPlanScalableMatrixWithTieredPricing) =>
10666+
newPlanScalableMatrixWithTieredPricing.Validate(),
10667+
(newPlanCumulativeGroupedBulk) => newPlanCumulativeGroupedBulk.Validate(),
10668+
(cumulativeGroupedAllocation) => cumulativeGroupedAllocation.Validate(),
10669+
(newPlanMinimumComposite) => newPlanMinimumComposite.Validate(),
10670+
(percent) => percent.Validate(),
10671+
(eventOutput) => eventOutput.Validate()
10672+
);
1058310673
}
1058410674

1058510675
public virtual bool Equals(ReplacePricePrice? other)
@@ -12106,6 +12196,7 @@ public void Validate()
1210612196
"Data did not match any variant of ReplacePricePriceBulkWithFiltersConversionRateConfig"
1210712197
);
1210812198
}
12199+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
1210912200
}
1211012201

1211112202
public virtual bool Equals(ReplacePricePriceBulkWithFiltersConversionRateConfig? other)
@@ -12898,6 +12989,7 @@ public void Validate()
1289812989
"Data did not match any variant of ReplacePricePriceTieredWithProrationConversionRateConfig"
1289912990
);
1290012991
}
12992+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
1290112993
}
1290212994

1290312995
public virtual bool Equals(ReplacePricePriceTieredWithProrationConversionRateConfig? other)
@@ -13633,6 +13725,7 @@ public void Validate()
1363313725
"Data did not match any variant of ReplacePricePriceGroupedWithMinMaxThresholdsConversionRateConfig"
1363413726
);
1363513727
}
13728+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
1363613729
}
1363713730

1363813731
public virtual bool Equals(
@@ -14370,6 +14463,7 @@ public void Validate()
1437014463
"Data did not match any variant of ReplacePricePriceCumulativeGroupedAllocationConversionRateConfig"
1437114464
);
1437214465
}
14466+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
1437314467
}
1437414468

1437514469
public virtual bool Equals(
@@ -15062,6 +15156,7 @@ public void Validate()
1506215156
"Data did not match any variant of ReplacePricePricePercentConversionRateConfig"
1506315157
);
1506415158
}
15159+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
1506515160
}
1506615161

1506715162
public virtual bool Equals(ReplacePricePricePercentConversionRateConfig? other)
@@ -15780,6 +15875,7 @@ public void Validate()
1578015875
"Data did not match any variant of ReplacePricePriceEventOutputConversionRateConfig"
1578115876
);
1578215877
}
15878+
this.Switch((unit) => unit.Validate(), (tiered) => tiered.Validate());
1578315879
}
1578415880

1578515881
public virtual bool Equals(ReplacePricePriceEventOutputConversionRateConfig? other)

0 commit comments

Comments
 (0)