Skip to content

Commit 8a87021

Browse files
feat(client): add Equals and ToString to params
1 parent 79d3471 commit 8a87021

File tree

251 files changed

+8036
-127
lines changed

Some content is hidden

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

251 files changed

+8036
-127
lines changed

src/Orb.Tests/Models/Alerts/AlertCreateForCustomerParamsTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ public void Url_Works()
8080

8181
Assert.Equal(new Uri("https://api.withorb.com/v1/alerts/customer_id/customer_id"), url);
8282
}
83+
84+
[Fact]
85+
public void CopyConstructor_Works()
86+
{
87+
var parameters = new Alerts::AlertCreateForCustomerParams
88+
{
89+
CustomerID = "customer_id",
90+
Currency = "currency",
91+
Type = Alerts::Type.CreditBalanceDepleted,
92+
Thresholds = [new(0)],
93+
};
94+
95+
Alerts::AlertCreateForCustomerParams copied = new(parameters);
96+
97+
Assert.Equal(parameters, copied);
98+
}
8399
}
84100

85101
public class TypeTest : TestBase

src/Orb.Tests/Models/Alerts/AlertCreateForExternalCustomerParamsTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ public void Url_Works()
8484
url
8585
);
8686
}
87+
88+
[Fact]
89+
public void CopyConstructor_Works()
90+
{
91+
var parameters = new AlertCreateForExternalCustomerParams
92+
{
93+
ExternalCustomerID = "external_customer_id",
94+
Currency = "currency",
95+
Type = AlertCreateForExternalCustomerParamsType.CreditBalanceDepleted,
96+
Thresholds = [new(0)],
97+
};
98+
99+
AlertCreateForExternalCustomerParams copied = new(parameters);
100+
101+
Assert.Equal(parameters, copied);
102+
}
87103
}
88104

89105
public class AlertCreateForExternalCustomerParamsTypeTest : TestBase

src/Orb.Tests/Models/Alerts/AlertCreateForSubscriptionParamsTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ public void Url_Works()
8383
url
8484
);
8585
}
86+
87+
[Fact]
88+
public void CopyConstructor_Works()
89+
{
90+
var parameters = new AlertCreateForSubscriptionParams
91+
{
92+
SubscriptionID = "subscription_id",
93+
Thresholds = [new(0)],
94+
Type = AlertCreateForSubscriptionParamsType.UsageExceeded,
95+
MetricID = "metric_id",
96+
};
97+
98+
AlertCreateForSubscriptionParams copied = new(parameters);
99+
100+
Assert.Equal(parameters, copied);
101+
}
86102
}
87103

88104
public class AlertCreateForSubscriptionParamsTypeTest : TestBase

src/Orb.Tests/Models/Alerts/AlertDisableParamsTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,18 @@ public void Url_Works()
6262
url
6363
);
6464
}
65+
66+
[Fact]
67+
public void CopyConstructor_Works()
68+
{
69+
var parameters = new AlertDisableParams
70+
{
71+
AlertConfigurationID = "alert_configuration_id",
72+
SubscriptionID = "subscription_id",
73+
};
74+
75+
AlertDisableParams copied = new(parameters);
76+
77+
Assert.Equal(parameters, copied);
78+
}
6579
}

src/Orb.Tests/Models/Alerts/AlertEnableParamsTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,18 @@ public void Url_Works()
6262
url
6363
);
6464
}
65+
66+
[Fact]
67+
public void CopyConstructor_Works()
68+
{
69+
var parameters = new AlertEnableParams
70+
{
71+
AlertConfigurationID = "alert_configuration_id",
72+
SubscriptionID = "subscription_id",
73+
};
74+
75+
AlertEnableParams copied = new(parameters);
76+
77+
Assert.Equal(parameters, copied);
78+
}
6579
}

src/Orb.Tests/Models/Alerts/AlertListParamsTest.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,25 @@ public void Url_Works()
166166
url
167167
);
168168
}
169+
170+
[Fact]
171+
public void CopyConstructor_Works()
172+
{
173+
var parameters = new AlertListParams
174+
{
175+
CreatedAtGt = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
176+
CreatedAtGte = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
177+
CreatedAtLt = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
178+
CreatedAtLte = DateTimeOffset.Parse("2019-12-27T18:11:19.117Z"),
179+
Cursor = "cursor",
180+
CustomerID = "customer_id",
181+
ExternalCustomerID = "external_customer_id",
182+
Limit = 1,
183+
SubscriptionID = "subscription_id",
184+
};
185+
186+
AlertListParams copied = new(parameters);
187+
188+
Assert.Equal(parameters, copied);
189+
}
169190
}

src/Orb.Tests/Models/Alerts/AlertRetrieveParamsTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@ public void Url_Works()
2424

2525
Assert.Equal(new Uri("https://api.withorb.com/v1/alerts/alert_id"), url);
2626
}
27+
28+
[Fact]
29+
public void CopyConstructor_Works()
30+
{
31+
var parameters = new AlertRetrieveParams { AlertID = "alert_id" };
32+
33+
AlertRetrieveParams copied = new(parameters);
34+
35+
Assert.Equal(parameters, copied);
36+
}
2737
}

src/Orb.Tests/Models/Alerts/AlertUpdateParamsTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,18 @@ public void Url_Works()
3939

4040
Assert.Equal(new Uri("https://api.withorb.com/v1/alerts/alert_configuration_id"), url);
4141
}
42+
43+
[Fact]
44+
public void CopyConstructor_Works()
45+
{
46+
var parameters = new AlertUpdateParams
47+
{
48+
AlertConfigurationID = "alert_configuration_id",
49+
Thresholds = [new(0)],
50+
};
51+
52+
AlertUpdateParams copied = new(parameters);
53+
54+
Assert.Equal(parameters, copied);
55+
}
4256
}

src/Orb.Tests/Models/Beta/BetaCreatePlanVersionParamsTest.cs

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,219 @@ public void Url_Works()
528528

529529
Assert.Equal(new Uri("https://api.withorb.com/v1/plans/plan_id/versions"), url);
530530
}
531+
532+
[Fact]
533+
public void CopyConstructor_Works()
534+
{
535+
var parameters = new BetaCreatePlanVersionParams
536+
{
537+
PlanID = "plan_id",
538+
Version = 0,
539+
AddAdjustments =
540+
[
541+
new()
542+
{
543+
Adjustment = new Models::NewPercentageDiscount()
544+
{
545+
AdjustmentType =
546+
Models::NewPercentageDiscountAdjustmentType.PercentageDiscount,
547+
PercentageDiscount = 0,
548+
AppliesToAll = Models::NewPercentageDiscountAppliesToAll.True,
549+
AppliesToItemIds = ["item_1", "item_2"],
550+
AppliesToPriceIds = ["price_1", "price_2"],
551+
Currency = "currency",
552+
Filters =
553+
[
554+
new()
555+
{
556+
Field = Models::NewPercentageDiscountFilterField.PriceID,
557+
Operator = Models::NewPercentageDiscountFilterOperator.Includes,
558+
Values = ["string"],
559+
},
560+
],
561+
IsInvoiceLevel = true,
562+
PriceType = Models::NewPercentageDiscountPriceType.Usage,
563+
},
564+
PlanPhaseOrder = 0,
565+
},
566+
],
567+
AddPrices =
568+
[
569+
new()
570+
{
571+
AllocationPrice = new()
572+
{
573+
Amount = "10.00",
574+
Cadence = Models::Cadence.Monthly,
575+
Currency = "USD",
576+
CustomExpiration = new()
577+
{
578+
Duration = 0,
579+
DurationUnit = Models::CustomExpirationDurationUnit.Day,
580+
},
581+
ExpiresAtEndOfCadence = true,
582+
Filters =
583+
[
584+
new()
585+
{
586+
Field = Models::NewAllocationPriceFilterField.ItemID,
587+
Operator = Models::NewAllocationPriceFilterOperator.Includes,
588+
Values = ["string"],
589+
},
590+
],
591+
ItemID = "item_id",
592+
PerUnitCostBasis = "per_unit_cost_basis",
593+
},
594+
PlanPhaseOrder = 0,
595+
Price = new Models::NewPlanUnitPrice()
596+
{
597+
Cadence = Models::NewPlanUnitPriceCadence.Annual,
598+
ItemID = "item_id",
599+
ModelType = Models::NewPlanUnitPriceModelType.Unit,
600+
Name = "Annual fee",
601+
UnitConfig = new() { UnitAmount = "unit_amount", Prorated = true },
602+
BillableMetricID = "billable_metric_id",
603+
BilledInAdvance = true,
604+
BillingCycleConfiguration = new()
605+
{
606+
Duration = 0,
607+
DurationUnit = Models::NewBillingCycleConfigurationDurationUnit.Day,
608+
},
609+
ConversionRate = 0,
610+
ConversionRateConfig = new Models::SharedUnitConversionRateConfig()
611+
{
612+
ConversionRateType =
613+
Models::SharedUnitConversionRateConfigConversionRateType.Unit,
614+
UnitConfig = new("unit_amount"),
615+
},
616+
Currency = "currency",
617+
DimensionalPriceConfiguration = new()
618+
{
619+
DimensionValues = ["string"],
620+
DimensionalPriceGroupID = "dimensional_price_group_id",
621+
ExternalDimensionalPriceGroupID = "external_dimensional_price_group_id",
622+
},
623+
ExternalPriceID = "external_price_id",
624+
FixedPriceQuantity = 0,
625+
InvoiceGroupingKey = "x",
626+
InvoicingCycleConfiguration = new()
627+
{
628+
Duration = 0,
629+
DurationUnit = Models::NewBillingCycleConfigurationDurationUnit.Day,
630+
},
631+
Metadata = new Dictionary<string, string?>() { { "foo", "string" } },
632+
ReferenceID = "reference_id",
633+
},
634+
},
635+
],
636+
RemoveAdjustments = [new() { AdjustmentID = "adjustment_id", PlanPhaseOrder = 0 }],
637+
RemovePrices = [new() { PriceID = "price_id", PlanPhaseOrder = 0 }],
638+
ReplaceAdjustments =
639+
[
640+
new()
641+
{
642+
Adjustment = new Models::NewPercentageDiscount()
643+
{
644+
AdjustmentType =
645+
Models::NewPercentageDiscountAdjustmentType.PercentageDiscount,
646+
PercentageDiscount = 0,
647+
AppliesToAll = Models::NewPercentageDiscountAppliesToAll.True,
648+
AppliesToItemIds = ["item_1", "item_2"],
649+
AppliesToPriceIds = ["price_1", "price_2"],
650+
Currency = "currency",
651+
Filters =
652+
[
653+
new()
654+
{
655+
Field = Models::NewPercentageDiscountFilterField.PriceID,
656+
Operator = Models::NewPercentageDiscountFilterOperator.Includes,
657+
Values = ["string"],
658+
},
659+
],
660+
IsInvoiceLevel = true,
661+
PriceType = Models::NewPercentageDiscountPriceType.Usage,
662+
},
663+
ReplacesAdjustmentID = "replaces_adjustment_id",
664+
PlanPhaseOrder = 0,
665+
},
666+
],
667+
ReplacePrices =
668+
[
669+
new()
670+
{
671+
ReplacesPriceID = "replaces_price_id",
672+
AllocationPrice = new()
673+
{
674+
Amount = "10.00",
675+
Cadence = Models::Cadence.Monthly,
676+
Currency = "USD",
677+
CustomExpiration = new()
678+
{
679+
Duration = 0,
680+
DurationUnit = Models::CustomExpirationDurationUnit.Day,
681+
},
682+
ExpiresAtEndOfCadence = true,
683+
Filters =
684+
[
685+
new()
686+
{
687+
Field = Models::NewAllocationPriceFilterField.ItemID,
688+
Operator = Models::NewAllocationPriceFilterOperator.Includes,
689+
Values = ["string"],
690+
},
691+
],
692+
ItemID = "item_id",
693+
PerUnitCostBasis = "per_unit_cost_basis",
694+
},
695+
PlanPhaseOrder = 0,
696+
Price = new Models::NewPlanUnitPrice()
697+
{
698+
Cadence = Models::NewPlanUnitPriceCadence.Annual,
699+
ItemID = "item_id",
700+
ModelType = Models::NewPlanUnitPriceModelType.Unit,
701+
Name = "Annual fee",
702+
UnitConfig = new() { UnitAmount = "unit_amount", Prorated = true },
703+
BillableMetricID = "billable_metric_id",
704+
BilledInAdvance = true,
705+
BillingCycleConfiguration = new()
706+
{
707+
Duration = 0,
708+
DurationUnit = Models::NewBillingCycleConfigurationDurationUnit.Day,
709+
},
710+
ConversionRate = 0,
711+
ConversionRateConfig = new Models::SharedUnitConversionRateConfig()
712+
{
713+
ConversionRateType =
714+
Models::SharedUnitConversionRateConfigConversionRateType.Unit,
715+
UnitConfig = new("unit_amount"),
716+
},
717+
Currency = "currency",
718+
DimensionalPriceConfiguration = new()
719+
{
720+
DimensionValues = ["string"],
721+
DimensionalPriceGroupID = "dimensional_price_group_id",
722+
ExternalDimensionalPriceGroupID = "external_dimensional_price_group_id",
723+
},
724+
ExternalPriceID = "external_price_id",
725+
FixedPriceQuantity = 0,
726+
InvoiceGroupingKey = "x",
727+
InvoicingCycleConfiguration = new()
728+
{
729+
Duration = 0,
730+
DurationUnit = Models::NewBillingCycleConfigurationDurationUnit.Day,
731+
},
732+
Metadata = new Dictionary<string, string?>() { { "foo", "string" } },
733+
ReferenceID = "reference_id",
734+
},
735+
},
736+
],
737+
SetAsDefault = true,
738+
};
739+
740+
BetaCreatePlanVersionParams copied = new(parameters);
741+
742+
Assert.Equal(parameters, copied);
743+
}
531744
}
532745

533746
public class AddAdjustmentTest : TestBase

0 commit comments

Comments
 (0)