Skip to content

Commit dda33ed

Browse files
feat(client): add response validation option
chore(client): simplify field validations
1 parent 3ec7070 commit dda33ed

File tree

338 files changed

+1075
-1819
lines changed

Some content is hidden

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

338 files changed

+1075
-1819
lines changed

src/Orb/Core/ClientOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public Uri BaseUrl
1717
set { _baseUrl = new(() => value); }
1818
}
1919

20+
public bool ResponseValidation { get; set; } = false;
21+
2022
public TimeSpan Timeout { get; set; } = TimeSpan.FromMinutes(1);
2123

2224
Lazy<string> _apiKey = new(() =>

src/Orb/IOrbClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public interface IOrbClient
2727

2828
Uri BaseUrl { get; init; }
2929

30+
bool ResponseValidation { get; init; }
31+
3032
TimeSpan Timeout { get; init; }
3133

3234
string APIKey { get; init; }

src/Orb/Models/AdjustmentInterval.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,7 @@ public override void Validate()
147147
{
148148
_ = this.ID;
149149
this.Adjustment.Validate();
150-
foreach (var item in this.AppliesToPriceIntervalIDs)
151-
{
152-
_ = item;
153-
}
150+
_ = this.AppliesToPriceIntervalIDs;
154151
_ = this.EndDate;
155152
_ = this.StartDate;
156153
}

src/Orb/Models/AllocationProperties/Filter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ public override void Validate()
9898
{
9999
this.Field.Validate();
100100
this.Operator.Validate();
101-
foreach (var item in this.Values)
102-
{
103-
_ = item;
104-
}
101+
_ = this.Values;
105102
}
106103

107104
public Filter() { }

src/Orb/Models/AmountDiscount.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ public override void Validate()
129129
{
130130
_ = this.AmountDiscount1;
131131
this.DiscountType.Validate();
132-
foreach (var item in this.AppliesToPriceIDs ?? [])
133-
{
134-
_ = item;
135-
}
132+
_ = this.AppliesToPriceIDs;
136133
foreach (var item in this.Filters ?? [])
137134
{
138135
item.Validate();

src/Orb/Models/AmountDiscountInterval.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,7 @@ public required DateTime StartDate
176176
public override void Validate()
177177
{
178178
_ = this.AmountDiscount;
179-
foreach (var item in this.AppliesToPriceIntervalIDs)
180-
{
181-
_ = item;
182-
}
179+
_ = this.AppliesToPriceIntervalIDs;
183180
this.DiscountType.Validate();
184181
_ = this.EndDate;
185182
foreach (var item in this.Filters)

src/Orb/Models/AmountDiscountIntervalProperties/Filter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ public override void Validate()
9898
{
9999
this.Field.Validate();
100100
this.Operator.Validate();
101-
foreach (var item in this.Values)
102-
{
103-
_ = item;
104-
}
101+
_ = this.Values;
105102
}
106103

107104
public Filter() { }

src/Orb/Models/AmountDiscountProperties/Filter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ public override void Validate()
9898
{
9999
this.Field.Validate();
100100
this.Operator.Validate();
101-
foreach (var item in this.Values)
102-
{
103-
_ = item;
104-
}
101+
_ = this.Values;
105102
}
106103

107104
public Filter() { }

src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/PriceProperties/BulkWithFilters.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,7 @@ public override void Validate()
481481
_ = this.FixedPriceQuantity;
482482
_ = this.InvoiceGroupingKey;
483483
this.InvoicingCycleConfiguration?.Validate();
484-
if (this.Metadata != null)
485-
{
486-
foreach (var item in this.Metadata.Values)
487-
{
488-
_ = item;
489-
}
490-
}
484+
_ = this.Metadata;
491485
_ = this.ReferenceID;
492486
}
493487

src/Orb/Models/Beta/BetaCreatePlanVersionParamsProperties/AddPriceProperties/PriceProperties/EventOutput.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,7 @@ public override void Validate()
481481
_ = this.FixedPriceQuantity;
482482
_ = this.InvoiceGroupingKey;
483483
this.InvoicingCycleConfiguration?.Validate();
484-
if (this.Metadata != null)
485-
{
486-
foreach (var item in this.Metadata.Values)
487-
{
488-
_ = item;
489-
}
490-
}
484+
_ = this.Metadata;
491485
_ = this.ReferenceID;
492486
}
493487

0 commit comments

Comments
 (0)