Skip to content

Commit 049b82c

Browse files
fix(internal): various minor code fixes
1 parent f4d1b52 commit 049b82c

492 files changed

Lines changed: 9981 additions & 5727 deletions

File tree

Some content is hidden

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

src/Orb/ModelBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public abstract record class ModelBase
77
{
88
public Dictionary<string, JsonElement> Properties { get; set; } = [];
99

10-
static readonly JsonSerializerOptions _toStringSerializerOptions = new()
10+
internal static readonly JsonSerializerOptions SerializerOptions = new();
11+
12+
static readonly JsonSerializerOptions _toStringSerializerOptions = new(SerializerOptions)
1113
{
1214
WriteIndented = true,
1315
};

src/Orb/Models/Address.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public required string? City
1616
if (!this.Properties.TryGetValue("city", out JsonElement element))
1717
throw new System::ArgumentOutOfRangeException("city", "Missing required argument");
1818

19-
return JsonSerializer.Deserialize<string?>(element);
19+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
2020
}
2121
set { this.Properties["city"] = JsonSerializer.SerializeToElement(value); }
2222
}
@@ -31,7 +31,7 @@ public required string? Country
3131
"Missing required argument"
3232
);
3333

34-
return JsonSerializer.Deserialize<string?>(element);
34+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
3535
}
3636
set { this.Properties["country"] = JsonSerializer.SerializeToElement(value); }
3737
}
@@ -43,7 +43,7 @@ public required string? Line1
4343
if (!this.Properties.TryGetValue("line1", out JsonElement element))
4444
throw new System::ArgumentOutOfRangeException("line1", "Missing required argument");
4545

46-
return JsonSerializer.Deserialize<string?>(element);
46+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
4747
}
4848
set { this.Properties["line1"] = JsonSerializer.SerializeToElement(value); }
4949
}
@@ -55,7 +55,7 @@ public required string? Line2
5555
if (!this.Properties.TryGetValue("line2", out JsonElement element))
5656
throw new System::ArgumentOutOfRangeException("line2", "Missing required argument");
5757

58-
return JsonSerializer.Deserialize<string?>(element);
58+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
5959
}
6060
set { this.Properties["line2"] = JsonSerializer.SerializeToElement(value); }
6161
}
@@ -70,7 +70,7 @@ public required string? PostalCode
7070
"Missing required argument"
7171
);
7272

73-
return JsonSerializer.Deserialize<string?>(element);
73+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
7474
}
7575
set { this.Properties["postal_code"] = JsonSerializer.SerializeToElement(value); }
7676
}
@@ -82,7 +82,7 @@ public required string? State
8282
if (!this.Properties.TryGetValue("state", out JsonElement element))
8383
throw new System::ArgumentOutOfRangeException("state", "Missing required argument");
8484

85-
return JsonSerializer.Deserialize<string?>(element);
85+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
8686
}
8787
set { this.Properties["state"] = JsonSerializer.SerializeToElement(value); }
8888
}

src/Orb/Models/AdjustmentInterval.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public required string ID
1717
if (!this.Properties.TryGetValue("id", out JsonElement element))
1818
throw new System::ArgumentOutOfRangeException("id", "Missing required argument");
1919

20-
return JsonSerializer.Deserialize<string>(element)
20+
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
2121
?? throw new System::ArgumentNullException("id");
2222
}
2323
set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); }
@@ -33,8 +33,10 @@ public required string ID
3333
"Missing required argument"
3434
);
3535

36-
return JsonSerializer.Deserialize<AdjustmentIntervalProperties::Adjustment>(element)
37-
?? throw new System::ArgumentNullException("adjustment");
36+
return JsonSerializer.Deserialize<AdjustmentIntervalProperties::Adjustment>(
37+
element,
38+
ModelBase.SerializerOptions
39+
) ?? throw new System::ArgumentNullException("adjustment");
3840
}
3941
set { this.Properties["adjustment"] = JsonSerializer.SerializeToElement(value); }
4042
}
@@ -57,7 +59,7 @@ out JsonElement element
5759
"Missing required argument"
5860
);
5961

60-
return JsonSerializer.Deserialize<List<string>>(element)
62+
return JsonSerializer.Deserialize<List<string>>(element, ModelBase.SerializerOptions)
6163
?? throw new System::ArgumentNullException("applies_to_price_interval_ids");
6264
}
6365
set
@@ -81,7 +83,10 @@ out JsonElement element
8183
"Missing required argument"
8284
);
8385

84-
return JsonSerializer.Deserialize<System::DateTime?>(element);
86+
return JsonSerializer.Deserialize<System::DateTime?>(
87+
element,
88+
ModelBase.SerializerOptions
89+
);
8590
}
8691
set { this.Properties["end_date"] = JsonSerializer.SerializeToElement(value); }
8792
}
@@ -99,7 +104,10 @@ out JsonElement element
99104
"Missing required argument"
100105
);
101106

102-
return JsonSerializer.Deserialize<System::DateTime>(element);
107+
return JsonSerializer.Deserialize<System::DateTime>(
108+
element,
109+
ModelBase.SerializerOptions
110+
);
103111
}
104112
set { this.Properties["start_date"] = JsonSerializer.SerializeToElement(value); }
105113
}

src/Orb/Models/AggregatedCost.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ public required List<PerPriceCost> PerPriceCosts
1919
"Missing required argument"
2020
);
2121

22-
return JsonSerializer.Deserialize<List<PerPriceCost>>(element)
23-
?? throw new System::ArgumentNullException("per_price_costs");
22+
return JsonSerializer.Deserialize<List<PerPriceCost>>(
23+
element,
24+
ModelBase.SerializerOptions
25+
) ?? throw new System::ArgumentNullException("per_price_costs");
2426
}
2527
set { this.Properties["per_price_costs"] = JsonSerializer.SerializeToElement(value); }
2628
}
@@ -38,7 +40,7 @@ public required string Subtotal
3840
"Missing required argument"
3941
);
4042

41-
return JsonSerializer.Deserialize<string>(element)
43+
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
4244
?? throw new System::ArgumentNullException("subtotal");
4345
}
4446
set { this.Properties["subtotal"] = JsonSerializer.SerializeToElement(value); }
@@ -54,7 +56,10 @@ public required string Subtotal
5456
"Missing required argument"
5557
);
5658

57-
return JsonSerializer.Deserialize<System::DateTime>(element);
59+
return JsonSerializer.Deserialize<System::DateTime>(
60+
element,
61+
ModelBase.SerializerOptions
62+
);
5863
}
5964
set { this.Properties["timeframe_end"] = JsonSerializer.SerializeToElement(value); }
6065
}
@@ -69,7 +74,10 @@ public required string Subtotal
6974
"Missing required argument"
7075
);
7176

72-
return JsonSerializer.Deserialize<System::DateTime>(element);
77+
return JsonSerializer.Deserialize<System::DateTime>(
78+
element,
79+
ModelBase.SerializerOptions
80+
);
7381
}
7482
set { this.Properties["timeframe_start"] = JsonSerializer.SerializeToElement(value); }
7583
}
@@ -84,7 +92,7 @@ public required string Total
8492
if (!this.Properties.TryGetValue("total", out JsonElement element))
8593
throw new System::ArgumentOutOfRangeException("total", "Missing required argument");
8694

87-
return JsonSerializer.Deserialize<string>(element)
95+
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
8896
?? throw new System::ArgumentNullException("total");
8997
}
9098
set { this.Properties["total"] = JsonSerializer.SerializeToElement(value); }

src/Orb/Models/Alerts/Alert.cs

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public required string ID
2626
if (!this.Properties.TryGetValue("id", out JsonElement element))
2727
throw new System::ArgumentOutOfRangeException("id", "Missing required argument");
2828

29-
return JsonSerializer.Deserialize<string>(element)
29+
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
3030
?? throw new System::ArgumentNullException("id");
3131
}
3232
set { this.Properties["id"] = JsonSerializer.SerializeToElement(value); }
@@ -45,7 +45,10 @@ public required string ID
4545
"Missing required argument"
4646
);
4747

48-
return JsonSerializer.Deserialize<System::DateTime>(element);
48+
return JsonSerializer.Deserialize<System::DateTime>(
49+
element,
50+
ModelBase.SerializerOptions
51+
);
4952
}
5053
set { this.Properties["created_at"] = JsonSerializer.SerializeToElement(value); }
5154
}
@@ -63,7 +66,7 @@ public required string? Currency
6366
"Missing required argument"
6467
);
6568

66-
return JsonSerializer.Deserialize<string?>(element);
69+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
6770
}
6871
set { this.Properties["currency"] = JsonSerializer.SerializeToElement(value); }
6972
}
@@ -81,7 +84,10 @@ public required CustomerMinified? Customer
8184
"Missing required argument"
8285
);
8386

84-
return JsonSerializer.Deserialize<CustomerMinified?>(element);
87+
return JsonSerializer.Deserialize<CustomerMinified?>(
88+
element,
89+
ModelBase.SerializerOptions
90+
);
8591
}
8692
set { this.Properties["customer"] = JsonSerializer.SerializeToElement(value); }
8793
}
@@ -99,7 +105,7 @@ public required bool Enabled
99105
"Missing required argument"
100106
);
101107

102-
return JsonSerializer.Deserialize<bool>(element);
108+
return JsonSerializer.Deserialize<bool>(element, ModelBase.SerializerOptions);
103109
}
104110
set { this.Properties["enabled"] = JsonSerializer.SerializeToElement(value); }
105111
}
@@ -117,7 +123,10 @@ public required bool Enabled
117123
"Missing required argument"
118124
);
119125

120-
return JsonSerializer.Deserialize<AlertProperties::Metric?>(element);
126+
return JsonSerializer.Deserialize<AlertProperties::Metric?>(
127+
element,
128+
ModelBase.SerializerOptions
129+
);
121130
}
122131
set { this.Properties["metric"] = JsonSerializer.SerializeToElement(value); }
123132
}
@@ -132,7 +141,10 @@ public required bool Enabled
132141
if (!this.Properties.TryGetValue("plan", out JsonElement element))
133142
throw new System::ArgumentOutOfRangeException("plan", "Missing required argument");
134143

135-
return JsonSerializer.Deserialize<AlertProperties::Plan?>(element);
144+
return JsonSerializer.Deserialize<AlertProperties::Plan?>(
145+
element,
146+
ModelBase.SerializerOptions
147+
);
136148
}
137149
set { this.Properties["plan"] = JsonSerializer.SerializeToElement(value); }
138150
}
@@ -150,7 +162,10 @@ public required SubscriptionMinified? Subscription
150162
"Missing required argument"
151163
);
152164

153-
return JsonSerializer.Deserialize<SubscriptionMinified?>(element);
165+
return JsonSerializer.Deserialize<SubscriptionMinified?>(
166+
element,
167+
ModelBase.SerializerOptions
168+
);
154169
}
155170
set { this.Properties["subscription"] = JsonSerializer.SerializeToElement(value); }
156171
}
@@ -168,7 +183,10 @@ public required List<Threshold>? Thresholds
168183
"Missing required argument"
169184
);
170185

171-
return JsonSerializer.Deserialize<List<Threshold>?>(element);
186+
return JsonSerializer.Deserialize<List<Threshold>?>(
187+
element,
188+
ModelBase.SerializerOptions
189+
);
172190
}
173191
set { this.Properties["thresholds"] = JsonSerializer.SerializeToElement(value); }
174192
}
@@ -183,8 +201,10 @@ public required List<Threshold>? Thresholds
183201
if (!this.Properties.TryGetValue("type", out JsonElement element))
184202
throw new System::ArgumentOutOfRangeException("type", "Missing required argument");
185203

186-
return JsonSerializer.Deserialize<AlertProperties::Type>(element)
187-
?? throw new System::ArgumentNullException("type");
204+
return JsonSerializer.Deserialize<AlertProperties::Type>(
205+
element,
206+
ModelBase.SerializerOptions
207+
) ?? throw new System::ArgumentNullException("type");
188208
}
189209
set { this.Properties["type"] = JsonSerializer.SerializeToElement(value); }
190210
}
@@ -199,7 +219,10 @@ public required List<Threshold>? Thresholds
199219
if (!this.Properties.TryGetValue("balance_alert_status", out JsonElement element))
200220
return null;
201221

202-
return JsonSerializer.Deserialize<List<AlertProperties::BalanceAlertStatus>?>(element);
222+
return JsonSerializer.Deserialize<List<AlertProperties::BalanceAlertStatus>?>(
223+
element,
224+
ModelBase.SerializerOptions
225+
);
203226
}
204227
set { this.Properties["balance_alert_status"] = JsonSerializer.SerializeToElement(value); }
205228
}

src/Orb/Models/Alerts/AlertCreateForCustomerParams.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public required string Currency
3434
"Missing required argument"
3535
);
3636

37-
return JsonSerializer.Deserialize<string>(element)
37+
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
3838
?? throw new System::ArgumentNullException("currency");
3939
}
4040
set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); }
@@ -50,8 +50,10 @@ public required string Currency
5050
if (!this.BodyProperties.TryGetValue("type", out JsonElement element))
5151
throw new System::ArgumentOutOfRangeException("type", "Missing required argument");
5252

53-
return JsonSerializer.Deserialize<AlertCreateForCustomerParamsProperties::Type>(element)
54-
?? throw new System::ArgumentNullException("type");
53+
return JsonSerializer.Deserialize<AlertCreateForCustomerParamsProperties::Type>(
54+
element,
55+
ModelBase.SerializerOptions
56+
) ?? throw new System::ArgumentNullException("type");
5557
}
5658
set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); }
5759
}
@@ -66,7 +68,10 @@ public List<Threshold>? Thresholds
6668
if (!this.BodyProperties.TryGetValue("thresholds", out JsonElement element))
6769
return null;
6870

69-
return JsonSerializer.Deserialize<List<Threshold>?>(element);
71+
return JsonSerializer.Deserialize<List<Threshold>?>(
72+
element,
73+
ModelBase.SerializerOptions
74+
);
7075
}
7176
set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); }
7277
}

src/Orb/Models/Alerts/AlertCreateForExternalCustomerParams.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public required string Currency
3434
"Missing required argument"
3535
);
3636

37-
return JsonSerializer.Deserialize<string>(element)
37+
return JsonSerializer.Deserialize<string>(element, ModelBase.SerializerOptions)
3838
?? throw new System::ArgumentNullException("currency");
3939
}
4040
set { this.BodyProperties["currency"] = JsonSerializer.SerializeToElement(value); }
@@ -51,7 +51,8 @@ public required string Currency
5151
throw new System::ArgumentOutOfRangeException("type", "Missing required argument");
5252

5353
return JsonSerializer.Deserialize<AlertCreateForExternalCustomerParamsProperties::Type>(
54-
element
54+
element,
55+
ModelBase.SerializerOptions
5556
) ?? throw new System::ArgumentNullException("type");
5657
}
5758
set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); }
@@ -67,7 +68,10 @@ public List<Threshold>? Thresholds
6768
if (!this.BodyProperties.TryGetValue("thresholds", out JsonElement element))
6869
return null;
6970

70-
return JsonSerializer.Deserialize<List<Threshold>?>(element);
71+
return JsonSerializer.Deserialize<List<Threshold>?>(
72+
element,
73+
ModelBase.SerializerOptions
74+
);
7175
}
7276
set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); }
7377
}

src/Orb/Models/Alerts/AlertCreateForSubscriptionParams.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public required List<Threshold> Thresholds
3939
"Missing required argument"
4040
);
4141

42-
return JsonSerializer.Deserialize<List<Threshold>>(element)
42+
return JsonSerializer.Deserialize<List<Threshold>>(element, ModelBase.SerializerOptions)
4343
?? throw new System::ArgumentNullException("thresholds");
4444
}
4545
set { this.BodyProperties["thresholds"] = JsonSerializer.SerializeToElement(value); }
@@ -56,7 +56,8 @@ public required List<Threshold> Thresholds
5656
throw new System::ArgumentOutOfRangeException("type", "Missing required argument");
5757

5858
return JsonSerializer.Deserialize<AlertCreateForSubscriptionParamsProperties::Type>(
59-
element
59+
element,
60+
ModelBase.SerializerOptions
6061
) ?? throw new System::ArgumentNullException("type");
6162
}
6263
set { this.BodyProperties["type"] = JsonSerializer.SerializeToElement(value); }
@@ -72,7 +73,7 @@ public string? MetricID
7273
if (!this.BodyProperties.TryGetValue("metric_id", out JsonElement element))
7374
return null;
7475

75-
return JsonSerializer.Deserialize<string?>(element);
76+
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
7677
}
7778
set { this.BodyProperties["metric_id"] = JsonSerializer.SerializeToElement(value); }
7879
}

0 commit comments

Comments
 (0)