Skip to content

Commit 30fe818

Browse files
chore(client): change name of underlying properties for models and params
1 parent 965ec12 commit 30fe818

File tree

350 files changed

+19472
-21477
lines changed

Some content is hidden

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

350 files changed

+19472
-21477
lines changed

src/Orb.Tests/Services/EventServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public async Task Ingest_Works()
4444
{
4545
EventName = "event_name",
4646
IdempotencyKey = "idempotency_key",
47-
Properties1 = new Dictionary<string, JsonElement>()
47+
Properties = new Dictionary<string, JsonElement>()
4848
{
4949
{ "foo", JsonSerializer.SerializeToElement("bar") },
5050
},

src/Orb/Core/ModelBase.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ namespace Orb.Core;
2424

2525
public abstract record class ModelBase
2626
{
27-
private protected FreezableDictionary<string, JsonElement> _properties = [];
27+
private protected FreezableDictionary<string, JsonElement> _rawData = [];
2828

29-
public IReadOnlyDictionary<string, JsonElement> Properties
29+
public IReadOnlyDictionary<string, JsonElement> RawData
3030
{
31-
get { return this._properties.Freeze(); }
31+
get { return this._rawData.Freeze(); }
3232
}
3333

3434
internal static readonly JsonSerializerOptions SerializerOptions = new()
@@ -863,7 +863,7 @@ public IReadOnlyDictionary<string, JsonElement> Properties
863863

864864
public sealed override string? ToString()
865865
{
866-
return JsonSerializer.Serialize(this.Properties, _toStringSerializerOptions);
866+
return JsonSerializer.Serialize(this.RawData, _toStringSerializerOptions);
867867
}
868868

869869
public abstract void Validate();
@@ -876,5 +876,5 @@ public IReadOnlyDictionary<string, JsonElement> Properties
876876
/// </summary>
877877
interface IFromRaw<T>
878878
{
879-
static abstract T FromRawUnchecked(IReadOnlyDictionary<string, JsonElement> properties);
879+
static abstract T FromRawUnchecked(IReadOnlyDictionary<string, JsonElement> rawData);
880880
}

src/Orb/Core/ModelConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ sealed class ModelConverter<TModel> : JsonConverter<TModel>
1414
JsonSerializerOptions options
1515
)
1616
{
17-
var properties = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(
17+
var rawData = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(
1818
ref reader,
1919
options
2020
);
21-
if (properties == null)
21+
if (rawData == null)
2222
return null;
2323

24-
return TModel.FromRawUnchecked(properties);
24+
return TModel.FromRawUnchecked(rawData);
2525
}
2626

2727
public override void Write(Utf8JsonWriter writer, TModel value, JsonSerializerOptions options)
2828
{
29-
JsonSerializer.Serialize(writer, value.Properties, options);
29+
JsonSerializer.Serialize(writer, value.RawData, options);
3030
}
3131
}

src/Orb/Core/ParamsBase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ static ParamsBase()
2929
};
3030
}
3131

32-
private protected FreezableDictionary<string, JsonElement> _queryProperties = [];
32+
private protected FreezableDictionary<string, JsonElement> _rawQueryData = [];
3333

34-
public IReadOnlyDictionary<string, JsonElement> QueryProperties
34+
public IReadOnlyDictionary<string, JsonElement> RawQueryData
3535
{
36-
get { return this._queryProperties.Freeze(); }
36+
get { return this._rawQueryData.Freeze(); }
3737
}
3838

39-
private protected FreezableDictionary<string, JsonElement> _headerProperties = [];
39+
private protected FreezableDictionary<string, JsonElement> _rawHeaderData = [];
4040

41-
public IReadOnlyDictionary<string, JsonElement> HeaderProperties
41+
public IReadOnlyDictionary<string, JsonElement> RawHeaderData
4242
{
43-
get { return this._headerProperties.Freeze(); }
43+
get { return this._rawHeaderData.Freeze(); }
4444
}
4545

4646
public abstract Uri Url(ClientOptions options);
@@ -148,7 +148,7 @@ JsonElement element
148148
protected string QueryString(ClientOptions options)
149149
{
150150
NameValueCollection collection = [];
151-
foreach (var item in this.QueryProperties)
151+
foreach (var item in this.RawQueryData)
152152
{
153153
ParamsBase.AddQueryElementToCollection(collection, item.Key, item.Value);
154154
}

src/Orb/Models/Address.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public required string? City
1414
{
1515
get
1616
{
17-
if (!this._properties.TryGetValue("city", out JsonElement element))
17+
if (!this._rawData.TryGetValue("city", out JsonElement element))
1818
return null;
1919

2020
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
2121
}
2222
init
2323
{
24-
this._properties["city"] = JsonSerializer.SerializeToElement(
24+
this._rawData["city"] = JsonSerializer.SerializeToElement(
2525
value,
2626
ModelBase.SerializerOptions
2727
);
@@ -32,14 +32,14 @@ public required string? Country
3232
{
3333
get
3434
{
35-
if (!this._properties.TryGetValue("country", out JsonElement element))
35+
if (!this._rawData.TryGetValue("country", out JsonElement element))
3636
return null;
3737

3838
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
3939
}
4040
init
4141
{
42-
this._properties["country"] = JsonSerializer.SerializeToElement(
42+
this._rawData["country"] = JsonSerializer.SerializeToElement(
4343
value,
4444
ModelBase.SerializerOptions
4545
);
@@ -50,14 +50,14 @@ public required string? Line1
5050
{
5151
get
5252
{
53-
if (!this._properties.TryGetValue("line1", out JsonElement element))
53+
if (!this._rawData.TryGetValue("line1", out JsonElement element))
5454
return null;
5555

5656
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
5757
}
5858
init
5959
{
60-
this._properties["line1"] = JsonSerializer.SerializeToElement(
60+
this._rawData["line1"] = JsonSerializer.SerializeToElement(
6161
value,
6262
ModelBase.SerializerOptions
6363
);
@@ -68,14 +68,14 @@ public required string? Line2
6868
{
6969
get
7070
{
71-
if (!this._properties.TryGetValue("line2", out JsonElement element))
71+
if (!this._rawData.TryGetValue("line2", out JsonElement element))
7272
return null;
7373

7474
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
7575
}
7676
init
7777
{
78-
this._properties["line2"] = JsonSerializer.SerializeToElement(
78+
this._rawData["line2"] = JsonSerializer.SerializeToElement(
7979
value,
8080
ModelBase.SerializerOptions
8181
);
@@ -86,14 +86,14 @@ public required string? PostalCode
8686
{
8787
get
8888
{
89-
if (!this._properties.TryGetValue("postal_code", out JsonElement element))
89+
if (!this._rawData.TryGetValue("postal_code", out JsonElement element))
9090
return null;
9191

9292
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
9393
}
9494
init
9595
{
96-
this._properties["postal_code"] = JsonSerializer.SerializeToElement(
96+
this._rawData["postal_code"] = JsonSerializer.SerializeToElement(
9797
value,
9898
ModelBase.SerializerOptions
9999
);
@@ -104,14 +104,14 @@ public required string? State
104104
{
105105
get
106106
{
107-
if (!this._properties.TryGetValue("state", out JsonElement element))
107+
if (!this._rawData.TryGetValue("state", out JsonElement element))
108108
return null;
109109

110110
return JsonSerializer.Deserialize<string?>(element, ModelBase.SerializerOptions);
111111
}
112112
init
113113
{
114-
this._properties["state"] = JsonSerializer.SerializeToElement(
114+
this._rawData["state"] = JsonSerializer.SerializeToElement(
115115
value,
116116
ModelBase.SerializerOptions
117117
);
@@ -130,21 +130,21 @@ public override void Validate()
130130

131131
public Address() { }
132132

133-
public Address(IReadOnlyDictionary<string, JsonElement> properties)
133+
public Address(IReadOnlyDictionary<string, JsonElement> rawData)
134134
{
135-
this._properties = [.. properties];
135+
this._rawData = [.. rawData];
136136
}
137137

138138
#pragma warning disable CS8618
139139
[SetsRequiredMembers]
140-
Address(FrozenDictionary<string, JsonElement> properties)
140+
Address(FrozenDictionary<string, JsonElement> rawData)
141141
{
142-
this._properties = [.. properties];
142+
this._rawData = [.. rawData];
143143
}
144144
#pragma warning restore CS8618
145145

146-
public static Address FromRawUnchecked(IReadOnlyDictionary<string, JsonElement> properties)
146+
public static Address FromRawUnchecked(IReadOnlyDictionary<string, JsonElement> rawData)
147147
{
148-
return new(FrozenDictionary.ToFrozenDictionary(properties));
148+
return new(FrozenDictionary.ToFrozenDictionary(rawData));
149149
}
150150
}

src/Orb/Models/AdjustmentInterval.cs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public required string ID
1616
{
1717
get
1818
{
19-
if (!this._properties.TryGetValue("id", out JsonElement element))
19+
if (!this._rawData.TryGetValue("id", out JsonElement element))
2020
throw new OrbInvalidDataException(
2121
"'id' cannot be null",
2222
new System::ArgumentOutOfRangeException("id", "Missing required argument")
@@ -30,7 +30,7 @@ public required string ID
3030
}
3131
init
3232
{
33-
this._properties["id"] = JsonSerializer.SerializeToElement(
33+
this._rawData["id"] = JsonSerializer.SerializeToElement(
3434
value,
3535
ModelBase.SerializerOptions
3636
);
@@ -41,7 +41,7 @@ public required AdjustmentIntervalAdjustment Adjustment
4141
{
4242
get
4343
{
44-
if (!this._properties.TryGetValue("adjustment", out JsonElement element))
44+
if (!this._rawData.TryGetValue("adjustment", out JsonElement element))
4545
throw new OrbInvalidDataException(
4646
"'adjustment' cannot be null",
4747
new System::ArgumentOutOfRangeException(
@@ -61,7 +61,7 @@ public required AdjustmentIntervalAdjustment Adjustment
6161
}
6262
init
6363
{
64-
this._properties["adjustment"] = JsonSerializer.SerializeToElement(
64+
this._rawData["adjustment"] = JsonSerializer.SerializeToElement(
6565
value,
6666
ModelBase.SerializerOptions
6767
);
@@ -76,10 +76,7 @@ public required List<string> AppliesToPriceIntervalIDs
7676
get
7777
{
7878
if (
79-
!this._properties.TryGetValue(
80-
"applies_to_price_interval_ids",
81-
out JsonElement element
82-
)
79+
!this._rawData.TryGetValue("applies_to_price_interval_ids", out JsonElement element)
8380
)
8481
throw new OrbInvalidDataException(
8582
"'applies_to_price_interval_ids' cannot be null",
@@ -97,7 +94,7 @@ out JsonElement element
9794
}
9895
init
9996
{
100-
this._properties["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement(
97+
this._rawData["applies_to_price_interval_ids"] = JsonSerializer.SerializeToElement(
10198
value,
10299
ModelBase.SerializerOptions
103100
);
@@ -111,7 +108,7 @@ out JsonElement element
111108
{
112109
get
113110
{
114-
if (!this._properties.TryGetValue("end_date", out JsonElement element))
111+
if (!this._rawData.TryGetValue("end_date", out JsonElement element))
115112
return null;
116113

117114
return JsonSerializer.Deserialize<System::DateTimeOffset?>(
@@ -121,7 +118,7 @@ out JsonElement element
121118
}
122119
init
123120
{
124-
this._properties["end_date"] = JsonSerializer.SerializeToElement(
121+
this._rawData["end_date"] = JsonSerializer.SerializeToElement(
125122
value,
126123
ModelBase.SerializerOptions
127124
);
@@ -135,7 +132,7 @@ out JsonElement element
135132
{
136133
get
137134
{
138-
if (!this._properties.TryGetValue("start_date", out JsonElement element))
135+
if (!this._rawData.TryGetValue("start_date", out JsonElement element))
139136
throw new OrbInvalidDataException(
140137
"'start_date' cannot be null",
141138
new System::ArgumentOutOfRangeException(
@@ -151,7 +148,7 @@ out JsonElement element
151148
}
152149
init
153150
{
154-
this._properties["start_date"] = JsonSerializer.SerializeToElement(
151+
this._rawData["start_date"] = JsonSerializer.SerializeToElement(
155152
value,
156153
ModelBase.SerializerOptions
157154
);
@@ -169,24 +166,24 @@ public override void Validate()
169166

170167
public AdjustmentInterval() { }
171168

172-
public AdjustmentInterval(IReadOnlyDictionary<string, JsonElement> properties)
169+
public AdjustmentInterval(IReadOnlyDictionary<string, JsonElement> rawData)
173170
{
174-
this._properties = [.. properties];
171+
this._rawData = [.. rawData];
175172
}
176173

177174
#pragma warning disable CS8618
178175
[SetsRequiredMembers]
179-
AdjustmentInterval(FrozenDictionary<string, JsonElement> properties)
176+
AdjustmentInterval(FrozenDictionary<string, JsonElement> rawData)
180177
{
181-
this._properties = [.. properties];
178+
this._rawData = [.. rawData];
182179
}
183180
#pragma warning restore CS8618
184181

185182
public static AdjustmentInterval FromRawUnchecked(
186-
IReadOnlyDictionary<string, JsonElement> properties
183+
IReadOnlyDictionary<string, JsonElement> rawData
187184
)
188185
{
189-
return new(FrozenDictionary.ToFrozenDictionary(properties));
186+
return new(FrozenDictionary.ToFrozenDictionary(rawData));
190187
}
191188
}
192189

0 commit comments

Comments
 (0)