Skip to content

Commit 0b9eedc

Browse files
feat: extract minimum composite to type
1 parent f13e7df commit 0b9eedc

File tree

109 files changed

+743
-8546
lines changed

Some content is hidden

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

109 files changed

+743
-8546
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6b2550b95f82872b3825619c109352352b9c92281c8b2470fce158e971142881.yml
33
openapi_spec_hash: 379df18de1af6a9d0b50d3653aab4d44
4-
config_hash: be9350529b910ec14bff0a30cd74a185
4+
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2

src/Orb/ModelBase.cs

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
using NewFloatingMatrixWithAllocationPriceProperties = Orb.Models.NewFloatingMatrixWithAllocationPriceProperties;
9393
using NewFloatingMatrixWithDisplayNamePriceProperties = Orb.Models.NewFloatingMatrixWithDisplayNamePriceProperties;
9494
using NewFloatingMaxGroupTieredPackagePriceProperties = Orb.Models.NewFloatingMaxGroupTieredPackagePriceProperties;
95+
using NewFloatingMinimumCompositePriceProperties = Orb.Models.NewFloatingMinimumCompositePriceProperties;
9596
using NewFloatingPackagePriceProperties = Orb.Models.NewFloatingPackagePriceProperties;
9697
using NewFloatingPackageWithAllocationPriceProperties = Orb.Models.NewFloatingPackageWithAllocationPriceProperties;
9798
using NewFloatingScalableMatrixWithTieredPricingPriceProperties = Orb.Models.NewFloatingScalableMatrixWithTieredPricingPriceProperties;
@@ -120,6 +121,7 @@
120121
using NewPlanMatrixWithAllocationPriceProperties = Orb.Models.NewPlanMatrixWithAllocationPriceProperties;
121122
using NewPlanMatrixWithDisplayNamePriceProperties = Orb.Models.NewPlanMatrixWithDisplayNamePriceProperties;
122123
using NewPlanMaxGroupTieredPackagePriceProperties = Orb.Models.NewPlanMaxGroupTieredPackagePriceProperties;
124+
using NewPlanMinimumCompositePriceProperties = Orb.Models.NewPlanMinimumCompositePriceProperties;
123125
using NewPlanPackagePriceProperties = Orb.Models.NewPlanPackagePriceProperties;
124126
using NewPlanPackageWithAllocationPriceProperties = Orb.Models.NewPlanPackageWithAllocationPriceProperties;
125127
using NewPlanScalableMatrixWithTieredPricingPriceProperties = Orb.Models.NewPlanScalableMatrixWithTieredPricingPriceProperties;
@@ -146,6 +148,7 @@
146148
using NewSubscriptionMatrixWithAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixWithAllocationPriceProperties;
147149
using NewSubscriptionMatrixWithDisplayNamePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMatrixWithDisplayNamePriceProperties;
148150
using NewSubscriptionMaxGroupTieredPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMaxGroupTieredPackagePriceProperties;
151+
using NewSubscriptionMinimumCompositePriceProperties = Orb.Models.Subscriptions.NewSubscriptionMinimumCompositePriceProperties;
149152
using NewSubscriptionPackagePriceProperties = Orb.Models.Subscriptions.NewSubscriptionPackagePriceProperties;
150153
using NewSubscriptionPackageWithAllocationPriceProperties = Orb.Models.Subscriptions.NewSubscriptionPackageWithAllocationPriceProperties;
151154
using NewSubscriptionScalableMatrixWithTieredPricingPriceProperties = Orb.Models.Subscriptions.NewSubscriptionScalableMatrixWithTieredPricingPriceProperties;
@@ -316,6 +319,8 @@ public abstract record class ModelBase
316319
string,
317320
NewFloatingMaxGroupTieredPackagePriceProperties::ModelType
318321
>(),
322+
new ApiEnumConverter<string, NewFloatingMinimumCompositePriceProperties::Cadence>(),
323+
new ApiEnumConverter<string, NewFloatingMinimumCompositePriceProperties::ModelType>(),
319324
new ApiEnumConverter<string, NewFloatingPackagePriceProperties::Cadence>(),
320325
new ApiEnumConverter<string, NewFloatingPackagePriceProperties::ModelType>(),
321326
new ApiEnumConverter<
@@ -417,6 +422,8 @@ public abstract record class ModelBase
417422
new ApiEnumConverter<string, NewPlanMatrixWithDisplayNamePriceProperties::ModelType>(),
418423
new ApiEnumConverter<string, NewPlanMaxGroupTieredPackagePriceProperties::Cadence>(),
419424
new ApiEnumConverter<string, NewPlanMaxGroupTieredPackagePriceProperties::ModelType>(),
425+
new ApiEnumConverter<string, NewPlanMinimumCompositePriceProperties::Cadence>(),
426+
new ApiEnumConverter<string, NewPlanMinimumCompositePriceProperties::ModelType>(),
420427
new ApiEnumConverter<string, NewPlanPackagePriceProperties::Cadence>(),
421428
new ApiEnumConverter<string, NewPlanPackagePriceProperties::ModelType>(),
422429
new ApiEnumConverter<string, NewPlanPackageWithAllocationPriceProperties::Cadence>(),
@@ -545,34 +552,18 @@ public abstract record class ModelBase
545552
string,
546553
global::Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
547554
>(),
548-
new ApiEnumConverter<
549-
string,
550-
global::Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceProperties.MinimumProperties.Cadence
551-
>(),
552555
new ApiEnumConverter<
553556
string,
554557
global::Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
555558
>(),
556-
new ApiEnumConverter<
557-
string,
558-
global::Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceProperties.MinimumProperties.Cadence
559-
>(),
560559
new ApiEnumConverter<
561560
string,
562561
global::Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
563562
>(),
564-
new ApiEnumConverter<
565-
string,
566-
global::Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.AddPriceProperties.PriceProperties.MinimumProperties.Cadence
567-
>(),
568563
new ApiEnumConverter<
569564
string,
570565
global::Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
571566
>(),
572-
new ApiEnumConverter<
573-
string,
574-
global::Orb.Models.Beta.ExternalPlanID.ExternalPlanIDCreatePlanVersionParamsProperties.ReplacePriceProperties.PriceProperties.MinimumProperties.Cadence
575-
>(),
576567
new ApiEnumConverter<string, Reason>(),
577568
new ApiEnumConverter<string, CustomerProperties::PaymentProvider>(),
578569
new ApiEnumConverter<string, ProviderType>(),
@@ -670,10 +661,6 @@ public abstract record class ModelBase
670661
string,
671662
global::Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
672663
>(),
673-
new ApiEnumConverter<
674-
string,
675-
global::Orb.Models.Plans.PlanCreateParamsProperties.PriceProperties.PriceProperties.MinimumProperties.Cadence
676-
>(),
677664
new ApiEnumConverter<
678665
string,
679666
global::Orb.Models.Plans.PlanCreateParamsProperties.PlanPhaseProperties.DurationUnit
@@ -684,26 +671,14 @@ public abstract record class ModelBase
684671
string,
685672
global::Orb.Models.Prices.PriceCreateParamsProperties.BodyProperties.GroupedWithMinMaxThresholdsProperties.Cadence
686673
>(),
687-
new ApiEnumConverter<
688-
string,
689-
global::Orb.Models.Prices.PriceCreateParamsProperties.BodyProperties.MinimumProperties.Cadence
690-
>(),
691674
new ApiEnumConverter<
692675
string,
693676
global::Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
694677
>(),
695-
new ApiEnumConverter<
696-
string,
697-
global::Orb.Models.Prices.PriceEvaluateMultipleParamsProperties.PriceEvaluationProperties.PriceProperties.MinimumProperties.Cadence
698-
>(),
699678
new ApiEnumConverter<
700679
string,
701680
global::Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
702681
>(),
703-
new ApiEnumConverter<
704-
string,
705-
global::Orb.Models.Prices.PriceEvaluatePreviewEventsParamsProperties.PriceEvaluationProperties.PriceProperties.MinimumProperties.Cadence
706-
>(),
707682
new ApiEnumConverter<string, DiscountOverrideProperties::DiscountType>(),
708683
new ApiEnumConverter<string, NewSubscriptionBulkPriceProperties::Cadence>(),
709684
new ApiEnumConverter<string, NewSubscriptionBulkPriceProperties::ModelType>(),
@@ -783,6 +758,11 @@ public abstract record class ModelBase
783758
string,
784759
NewSubscriptionMaxGroupTieredPackagePriceProperties::ModelType
785760
>(),
761+
new ApiEnumConverter<string, NewSubscriptionMinimumCompositePriceProperties::Cadence>(),
762+
new ApiEnumConverter<
763+
string,
764+
NewSubscriptionMinimumCompositePriceProperties::ModelType
765+
>(),
786766
new ApiEnumConverter<string, NewSubscriptionPackagePriceProperties::Cadence>(),
787767
new ApiEnumConverter<string, NewSubscriptionPackagePriceProperties::ModelType>(),
788768
new ApiEnumConverter<
@@ -873,19 +853,11 @@ public abstract record class ModelBase
873853
string,
874854
global::Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
875855
>(),
876-
new ApiEnumConverter<
877-
string,
878-
global::Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.AddPriceProperties.PriceProperties.MinimumProperties.Cadence
879-
>(),
880856
new ApiEnumConverter<string, ExternalMarketplace>(),
881857
new ApiEnumConverter<
882858
string,
883859
global::Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
884860
>(),
885-
new ApiEnumConverter<
886-
string,
887-
global::Orb.Models.Subscriptions.SubscriptionCreateParamsProperties.ReplacePriceProperties.PriceProperties.MinimumProperties.Cadence
888-
>(),
889861
new ApiEnumConverter<string, SubscriptionListParamsProperties::Status>(),
890862
new ApiEnumConverter<string, CancelOption>(),
891863
new ApiEnumConverter<string, SubscriptionFetchCostsParamsProperties::ViewMode>(),
@@ -895,10 +867,6 @@ public abstract record class ModelBase
895867
string,
896868
global::Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
897869
>(),
898-
new ApiEnumConverter<
899-
string,
900-
global::Orb.Models.Subscriptions.SubscriptionPriceIntervalsParamsProperties.AddProperties.PriceProperties.MinimumProperties.Cadence
901-
>(),
902870
new ApiEnumConverter<string, ChangeOption>(),
903871
new ApiEnumConverter<
904872
string,
@@ -908,10 +876,6 @@ public abstract record class ModelBase
908876
string,
909877
global::Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
910878
>(),
911-
new ApiEnumConverter<
912-
string,
913-
global::Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.AddPriceProperties.PriceProperties.MinimumProperties.Cadence
914-
>(),
915879
new ApiEnumConverter<
916880
string,
917881
SubscriptionSchedulePlanChangeParamsProperties::BillingCycleAlignment
@@ -920,10 +884,6 @@ public abstract record class ModelBase
920884
string,
921885
global::Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties.PriceProperties.GroupedWithMinMaxThresholdsProperties.Cadence
922886
>(),
923-
new ApiEnumConverter<
924-
string,
925-
global::Orb.Models.Subscriptions.SubscriptionSchedulePlanChangeParamsProperties.ReplacePriceProperties.PriceProperties.MinimumProperties.Cadence
926-
>(),
927887
new ApiEnumConverter<
928888
string,
929889
SubscriptionUpdateFixedFeeQuantityParamsProperties::ChangeOption

src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/Price.cs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
using System.Diagnostics.CodeAnalysis;
44
using System.Text.Json;
55
using System.Text.Json.Serialization;
6+
using Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceProperties;
67
using Models = Orb.Models;
7-
using PriceProperties = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceProperties;
88
using PriceVariants = Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties.PriceVariants;
99

1010
namespace Orb.Models.Beta.BetaCreatePlanVersionParamsProperties.AddPriceProperties;
@@ -62,7 +62,7 @@ public static implicit operator Price(Models::NewPlanGroupedWithProratedMinimumP
6262
public static implicit operator Price(Models::NewPlanGroupedWithMeteredMinimumPrice value) =>
6363
new PriceVariants::NewPlanGroupedWithMeteredMinimumPrice(value);
6464

65-
public static implicit operator Price(PriceProperties::GroupedWithMinMaxThresholds value) =>
65+
public static implicit operator Price(GroupedWithMinMaxThresholds value) =>
6666
new PriceVariants::GroupedWithMinMaxThresholds(value);
6767

6868
public static implicit operator Price(Models::NewPlanMatrixWithDisplayNamePrice value) =>
@@ -97,8 +97,8 @@ public static implicit operator Price(Models::NewPlanMatrixWithAllocationPrice v
9797
public static implicit operator Price(Models::NewPlanGroupedTieredPrice value) =>
9898
new PriceVariants::NewPlanGroupedTieredPrice(value);
9999

100-
public static implicit operator Price(PriceProperties::Minimum value) =>
101-
new PriceVariants::Minimum(value);
100+
public static implicit operator Price(Models::NewPlanMinimumCompositePrice value) =>
101+
new PriceVariants::NewPlanMinimumCompositePrice(value);
102102

103103
public bool TryPickNewPlanUnit([NotNullWhen(true)] out Models::NewPlanUnitPrice? value)
104104
{
@@ -211,7 +211,7 @@ public bool TryPickNewPlanGroupedWithMeteredMinimum(
211211
}
212212

213213
public bool TryPickGroupedWithMinMaxThresholds(
214-
[NotNullWhen(true)] out PriceProperties::GroupedWithMinMaxThresholds? value
214+
[NotNullWhen(true)] out GroupedWithMinMaxThresholds? value
215215
)
216216
{
217217
value = (this as PriceVariants::GroupedWithMinMaxThresholds)?.Value;
@@ -298,9 +298,11 @@ public bool TryPickNewPlanGroupedTiered(
298298
return value != null;
299299
}
300300

301-
public bool TryPickMinimum([NotNullWhen(true)] out PriceProperties::Minimum? value)
301+
public bool TryPickNewPlanMinimumComposite(
302+
[NotNullWhen(true)] out Models::NewPlanMinimumCompositePrice? value
303+
)
302304
{
303-
value = (this as PriceVariants::Minimum)?.Value;
305+
value = (this as PriceVariants::NewPlanMinimumCompositePrice)?.Value;
304306
return value != null;
305307
}
306308

@@ -331,7 +333,7 @@ public void Switch(
331333
Action<PriceVariants::NewPlanTieredPackageWithMinimumPrice> newPlanTieredPackageWithMinimum,
332334
Action<PriceVariants::NewPlanMatrixWithAllocationPrice> newPlanMatrixWithAllocation,
333335
Action<PriceVariants::NewPlanGroupedTieredPrice> newPlanGroupedTiered,
334-
Action<PriceVariants::Minimum> minimum
336+
Action<PriceVariants::NewPlanMinimumCompositePrice> newPlanMinimumComposite
335337
)
336338
{
337339
switch (this)
@@ -414,8 +416,8 @@ public void Switch(
414416
case PriceVariants::NewPlanGroupedTieredPrice inner:
415417
newPlanGroupedTiered(inner);
416418
break;
417-
case PriceVariants::Minimum inner:
418-
minimum(inner);
419+
case PriceVariants::NewPlanMinimumCompositePrice inner:
420+
newPlanMinimumComposite(inner);
419421
break;
420422
default:
421423
throw new InvalidOperationException();
@@ -464,7 +466,7 @@ public T Match<T>(
464466
> newPlanTieredPackageWithMinimum,
465467
Func<PriceVariants::NewPlanMatrixWithAllocationPrice, T> newPlanMatrixWithAllocation,
466468
Func<PriceVariants::NewPlanGroupedTieredPrice, T> newPlanGroupedTiered,
467-
Func<PriceVariants::Minimum, T> minimum
469+
Func<PriceVariants::NewPlanMinimumCompositePrice, T> newPlanMinimumComposite
468470
)
469471
{
470472
return this switch
@@ -514,7 +516,7 @@ public T Match<T>(
514516
inner
515517
),
516518
PriceVariants::NewPlanGroupedTieredPrice inner => newPlanGroupedTiered(inner),
517-
PriceVariants::Minimum inner => minimum(inner),
519+
PriceVariants::NewPlanMinimumCompositePrice inner => newPlanMinimumComposite(inner),
518520
_ => throw new InvalidOperationException(),
519521
};
520522
}
@@ -893,11 +895,10 @@ JsonSerializerOptions options
893895

894896
try
895897
{
896-
var deserialized =
897-
JsonSerializer.Deserialize<PriceProperties::GroupedWithMinMaxThresholds>(
898-
json,
899-
options
900-
);
898+
var deserialized = JsonSerializer.Deserialize<GroupedWithMinMaxThresholds>(
899+
json,
900+
options
901+
);
901902
if (deserialized != null)
902903
{
903904
return new PriceVariants::GroupedWithMinMaxThresholds(deserialized);
@@ -1152,13 +1153,14 @@ JsonSerializerOptions options
11521153

11531154
try
11541155
{
1155-
var deserialized = JsonSerializer.Deserialize<PriceProperties::Minimum>(
1156-
json,
1157-
options
1158-
);
1156+
var deserialized =
1157+
JsonSerializer.Deserialize<Models::NewPlanMinimumCompositePrice>(
1158+
json,
1159+
options
1160+
);
11591161
if (deserialized != null)
11601162
{
1161-
return new PriceVariants::Minimum(deserialized);
1163+
return new PriceVariants::NewPlanMinimumCompositePrice(deserialized);
11621164
}
11631165
}
11641166
catch (JsonException e)
@@ -1232,7 +1234,8 @@ var newPlanTieredPackageWithMinimum
12321234
newPlanMatrixWithAllocation,
12331235
PriceVariants::NewPlanGroupedTieredPrice(var newPlanGroupedTiered) =>
12341236
newPlanGroupedTiered,
1235-
PriceVariants::Minimum(var minimum) => minimum,
1237+
PriceVariants::NewPlanMinimumCompositePrice(var newPlanMinimumComposite) =>
1238+
newPlanMinimumComposite,
12361239
_ => throw new ArgumentOutOfRangeException(nameof(value)),
12371240
};
12381241
JsonSerializer.Serialize(writer, variant, options);

0 commit comments

Comments
 (0)