Skip to content

Commit 5531ccd

Browse files
Merge pull request #11 from CarterGames/pre-release
📦 0.5.3 Release
2 parents 365c7da + 541a1dc commit 5531ccd

File tree

15 files changed

+137
-74
lines changed

15 files changed

+137
-74
lines changed

Carter Games/Notion Database To Unity/Code/Editor/Notion/Notion Api/Download Result/NotionDownloadParser.cs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,67 +93,71 @@ private static NotionDatabaseRow GetRowData(JSONNode element)
9393
for (var i = 0; i < keys.Count; i++)
9494
{
9595
var adjustedKey = keys[i].Trim().ToLower().Replace(" ", string.Empty);
96+
var actualKey = keys[i];
9697
var valueForType = GetValueForType(element.AsObject[i]["type"].Value, element.AsObject[i]);
9798
var valueJson = valueForType;
9899
var downloadText = element.AsObject[i].ToString();
99100

101+
var propertyData = new NotionPropertyData(actualKey, valueForType, valueJson, downloadText);
102+
100103
switch (element.AsObject[i]["type"].Value)
101104
{
102105
case "title":
103-
lookup.Add(adjustedKey, NotionPropertyFactory.Title(valueForType, valueJson, downloadText));
106+
lookup.Add(adjustedKey, NotionPropertyFactory.Title(propertyData));
104107
break;
105108
case "rich_text":
106-
lookup.Add(adjustedKey, NotionPropertyFactory.RichText(valueForType, valueJson, downloadText));
109+
lookup.Add(adjustedKey, NotionPropertyFactory.RichText(propertyData));
107110
break;
108111
case "number":
109-
lookup.Add(adjustedKey, NotionPropertyFactory.Number(valueForType, valueJson, downloadText));
112+
lookup.Add(adjustedKey, NotionPropertyFactory.Number(propertyData));
110113
break;
111114
case "checkbox":
112-
lookup.Add(adjustedKey, NotionPropertyFactory.Checkbox(valueForType, valueJson, downloadText));
115+
lookup.Add(adjustedKey, NotionPropertyFactory.Checkbox(propertyData));
113116
break;
114117
case "select":
115-
lookup.Add(adjustedKey, NotionPropertyFactory.Select(valueForType, valueJson, downloadText));
118+
lookup.Add(adjustedKey, NotionPropertyFactory.Select(propertyData));
116119
break;
117120
case "status":
118-
lookup.Add(adjustedKey, NotionPropertyFactory.Status(valueForType, valueJson, downloadText));
121+
lookup.Add(adjustedKey, NotionPropertyFactory.Status(propertyData));
119122
break;
120123
case "date":
121-
lookup.Add(adjustedKey, NotionPropertyFactory.Date(valueForType, valueJson, downloadText));
124+
lookup.Add(adjustedKey, NotionPropertyFactory.Date(propertyData));
122125
break;
123126
case "multi_select":
124-
lookup.Add(adjustedKey, NotionPropertyFactory.MultiSelect(valueForType, valueJson, downloadText));
127+
lookup.Add(adjustedKey, NotionPropertyFactory.MultiSelect(propertyData));
125128
break;
126129
case "rollup":
127130

128131
downloadText = element.AsObject[i]["rollup"]["array"][0].ToString();
129132
valueJson = GetValueForType(element.AsObject[i]["rollup"]["array"][0]["type"].Value, element.AsObject[i]["rollup"]["array"][0]);
130133
valueForType = valueJson;
134+
propertyData = new NotionPropertyData(actualKey, valueForType, valueJson, downloadText);
131135

132136
switch (element.AsObject[i]["rollup"]["array"][0]["type"].Value)
133137
{
134138
case "title":
135-
lookup.Add(adjustedKey, NotionPropertyFactory.Title(valueForType, valueJson, downloadText));
139+
lookup.Add(adjustedKey, NotionPropertyFactory.Title(propertyData));
136140
break;
137141
case "rich_text":
138-
lookup.Add(adjustedKey, NotionPropertyFactory.RichText(valueForType, valueJson, downloadText));
142+
lookup.Add(adjustedKey, NotionPropertyFactory.RichText(propertyData));
139143
break;
140144
case "number":
141-
lookup.Add(adjustedKey, NotionPropertyFactory.Number(valueForType, valueJson, downloadText));
145+
lookup.Add(adjustedKey, NotionPropertyFactory.Number(propertyData));
142146
break;
143147
case "checkbox":
144-
lookup.Add(adjustedKey, NotionPropertyFactory.Checkbox(valueForType, valueJson, downloadText));
148+
lookup.Add(adjustedKey, NotionPropertyFactory.Checkbox(propertyData));
145149
break;
146150
case "select":
147-
lookup.Add(adjustedKey, NotionPropertyFactory.Select(valueForType, valueJson, downloadText));
151+
lookup.Add(adjustedKey, NotionPropertyFactory.Select(propertyData));
148152
break;
149153
case "status":
150-
lookup.Add(adjustedKey, NotionPropertyFactory.Status(valueForType, valueJson, downloadText));
154+
lookup.Add(adjustedKey, NotionPropertyFactory.Status(propertyData));
151155
break;
152156
case "date":
153-
lookup.Add(adjustedKey, NotionPropertyFactory.Date(valueForType, valueJson, downloadText));
157+
lookup.Add(adjustedKey, NotionPropertyFactory.Date(propertyData));
154158
break;
155159
case "multi_select":
156-
lookup.Add(adjustedKey, NotionPropertyFactory.MultiSelect(valueForType, valueJson, downloadText));
160+
lookup.Add(adjustedKey, NotionPropertyFactory.MultiSelect(propertyData));
157161
break;
158162
}
159163

Carter Games/Notion Database To Unity/Code/Editor/Supporting Backend/AssetInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static class AssetInfo
3131
/// <summary>
3232
/// The version number of the asset.
3333
/// </summary>
34-
public static string VersionNumber => "0.5.2";
34+
public static string VersionNumber => "0.5.3";
3535

3636

3737
/// <summary>

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionProperty.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public abstract class NotionProperty
3434
| Fields
3535
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
3636

37+
/// <summary>
38+
/// The name of the property in Notion without being forced to a lower string.
39+
/// </summary>
40+
public string PropertyName { get; protected set; }
41+
42+
3743
/// <summary>
3844
/// The typed-value, stored in an object so it can be generic without a type required.
3945
/// </summary>
@@ -59,56 +65,56 @@ public abstract class NotionProperty
5965
/// Converts this data to a checkbox property.
6066
/// </summary>
6167
/// <returns>NotionPropertyCheckbox</returns>
62-
public NotionPropertyCheckbox CheckBox() => NotionPropertyFactory.Checkbox(InternalValue, JsonValue, DownloadText);
68+
public NotionPropertyCheckbox CheckBox() => NotionPropertyFactory.Checkbox(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
6369

6470

6571
/// <summary>
6672
/// Converts this data to a date property.
6773
/// </summary>
6874
/// <returns>NotionPropertyDate</returns>
69-
public NotionPropertyDate Date() => NotionPropertyFactory.Date(InternalValue, JsonValue, DownloadText);
75+
public NotionPropertyDate Date() => NotionPropertyFactory.Date(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
7076

7177

7278
/// <summary>
7379
/// Converts this data to a multi-select property.
7480
/// </summary>
7581
/// <returns>NotionPropertyMultiSelect</returns>
76-
public NotionPropertyMultiSelect MultiSelect() => NotionPropertyFactory.MultiSelect(InternalValue, JsonValue, DownloadText);
82+
public NotionPropertyMultiSelect MultiSelect() => NotionPropertyFactory.MultiSelect(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
7783

7884

7985
/// <summary>
8086
/// Converts this data to a select property.
8187
/// </summary>
8288
/// <returns>NotionPropertySelect</returns>
83-
public NotionPropertySelect Select() => NotionPropertyFactory.Select(InternalValue, JsonValue, DownloadText);
89+
public NotionPropertySelect Select() => NotionPropertyFactory.Select(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
8490

8591

8692
/// <summary>
8793
/// Converts this data to a select property.
8894
/// </summary>
8995
/// <returns>NotionPropertyStatus</returns>
90-
public NotionPropertyStatus Status() => NotionPropertyFactory.Status(InternalValue, JsonValue, DownloadText);
96+
public NotionPropertyStatus Status() => NotionPropertyFactory.Status(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
9197

9298

9399
/// <summary>
94100
/// Converts this data to a number property.
95101
/// </summary>
96102
/// <returns>NotionPropertyNumber</returns>
97-
public NotionPropertyNumber Number() => NotionPropertyFactory.Number(InternalValue, JsonValue, DownloadText);
103+
public NotionPropertyNumber Number() => NotionPropertyFactory.Number(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
98104

99105

100106
/// <summary>
101107
/// Converts this data to a richtext property.
102108
/// </summary>
103109
/// <returns>NotionPropertyRichText</returns>
104-
public NotionPropertyRichText RichText() => NotionPropertyFactory.RichText(InternalValue, JsonValue, DownloadText);
110+
public NotionPropertyRichText RichText() => NotionPropertyFactory.RichText(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
105111

106112

107113
/// <summary>
108114
/// Converts this data to a title property.
109115
/// </summary>
110116
/// <returns>NotionPropertyTitle</returns>
111-
public NotionPropertyTitle Title() => NotionPropertyFactory.Title(InternalValue, JsonValue, DownloadText);
117+
public NotionPropertyTitle Title() => NotionPropertyFactory.Title(new NotionPropertyData(PropertyName, InternalValue, JsonValue, DownloadText));
112118

113119
/* ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
114120
| Helper Methods

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionPropertyCheckbox.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ public sealed class NotionPropertyCheckbox : NotionProperty
5959
| Constructors
6060
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
6161

62-
public NotionPropertyCheckbox(bool value, string jsonValue, string downloadedText)
62+
public NotionPropertyCheckbox(NotionPropertyData data)
6363
{
64-
InternalValue = value;
65-
JsonValue = jsonValue;
66-
DownloadText = downloadedText;
64+
PropertyName = data.propertyName;
65+
InternalValue = bool.Parse(data.jsonValue);
66+
JsonValue = data.jsonValue;
67+
DownloadText = data.downloadText;
6768
}
6869
}
6970
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2025 Carter Games
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
* THE SOFTWARE.
22+
*/
23+
24+
namespace CarterGames.Standalone.NotionData
25+
{
26+
public struct NotionPropertyData
27+
{
28+
public string propertyName;
29+
public object valueForType;
30+
public string jsonValue;
31+
public string downloadText;
32+
33+
34+
public NotionPropertyData(string propertyName, object valueForType, string jsonValue, string downloadText)
35+
{
36+
this.propertyName = propertyName;
37+
this.valueForType = valueForType;
38+
this.jsonValue = jsonValue;
39+
this.downloadText = downloadText;
40+
}
41+
}
42+
}

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionPropertyData.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionPropertyDate.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ public sealed class NotionPropertyDate : NotionProperty
5959
| Constructors
6060
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
6161

62-
public NotionPropertyDate(SerializableDateTime value, string jsonValue, string downloadedText)
62+
public NotionPropertyDate(NotionPropertyData data)
6363
{
64-
InternalValue = value;
65-
JsonValue = jsonValue;
66-
DownloadText = downloadedText;
64+
PropertyName = data.propertyName;
65+
InternalValue = (SerializableDateTime) data.valueForType;
66+
JsonValue = data.jsonValue;
67+
DownloadText = data.downloadText;
6768
}
6869
}
6970
}

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionPropertyFactory.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,51 +29,51 @@ namespace CarterGames.Standalone.NotionData
2929
/// <remarks>Use NotionProperty.cs class to use these methods as intended.</remarks>
3030
public static class NotionPropertyFactory
3131
{
32-
public static NotionPropertyCheckbox Checkbox(object value, string jsonValue, string rawDownloadText)
32+
public static NotionPropertyCheckbox Checkbox(NotionPropertyData data)
3333
{
34-
return new NotionPropertyCheckbox(bool.Parse(jsonValue), jsonValue, rawDownloadText);
34+
return new NotionPropertyCheckbox(data);
3535
}
3636

3737

38-
public static NotionPropertyDate Date(object value, string jsonValue, string rawDownloadText)
38+
public static NotionPropertyDate Date(NotionPropertyData data)
3939
{
40-
return new NotionPropertyDate((SerializableDateTime) value, jsonValue, rawDownloadText);
40+
return new NotionPropertyDate(data);
4141
}
4242

4343

44-
public static NotionPropertyMultiSelect MultiSelect(object value, string jsonValue, string rawDownloadText)
44+
public static NotionPropertyMultiSelect MultiSelect(NotionPropertyData data)
4545
{
46-
return new NotionPropertyMultiSelect((string[]) value, jsonValue, rawDownloadText);
46+
return new NotionPropertyMultiSelect(data);
4747
}
4848

4949

50-
public static NotionPropertySelect Select(object value, string jsonValue, string rawDownloadText)
50+
public static NotionPropertySelect Select(NotionPropertyData data)
5151
{
52-
return new NotionPropertySelect((string) value, jsonValue, rawDownloadText);
52+
return new NotionPropertySelect(data);
5353
}
5454

5555

56-
public static NotionPropertyRichText RichText(object value, string jsonValue, string rawDownloadText)
56+
public static NotionPropertyRichText RichText(NotionPropertyData data)
5757
{
58-
return new NotionPropertyRichText((string) value, jsonValue, rawDownloadText);
58+
return new NotionPropertyRichText(data);
5959
}
6060

6161

62-
public static NotionPropertyTitle Title(object value, string jsonValue, string rawDownloadText)
62+
public static NotionPropertyTitle Title(NotionPropertyData data)
6363
{
64-
return new NotionPropertyTitle((string) value, jsonValue, rawDownloadText);
64+
return new NotionPropertyTitle(data);
6565
}
6666

6767

68-
public static NotionPropertyStatus Status(object value, string jsonValue, string rawDownloadText)
68+
public static NotionPropertyStatus Status(NotionPropertyData data)
6969
{
70-
return new NotionPropertyStatus((string) value, jsonValue, rawDownloadText);
70+
return new NotionPropertyStatus(data);
7171
}
7272

7373

74-
public static NotionPropertyNumber Number(object value, string jsonValue, string rawDownloadText)
74+
public static NotionPropertyNumber Number(NotionPropertyData data)
7575
{
76-
return new NotionPropertyNumber(double.Parse(jsonValue), jsonValue, rawDownloadText);
76+
return new NotionPropertyNumber(data);
7777
}
7878
}
7979
}

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionPropertyMultiSelect.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ public sealed class NotionPropertyMultiSelect : NotionProperty
5959
| Constructors
6060
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
6161

62-
public NotionPropertyMultiSelect(string[] value, string jsonValue, string downloadedText)
62+
public NotionPropertyMultiSelect(NotionPropertyData data)
6363
{
64-
InternalValue = value;
65-
JsonValue = jsonValue;
66-
DownloadText = downloadedText;
64+
PropertyName = data.propertyName;
65+
InternalValue = (string[]) data.valueForType;
66+
JsonValue = data.jsonValue;
67+
DownloadText = data.downloadText;
6768
}
6869
}
6970
}

Carter Games/Notion Database To Unity/Code/Runtime/Notion/Notion Database Handling/Properties/NotionPropertyNumber.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ public sealed class NotionPropertyNumber : NotionProperty
5959
| Constructors
6060
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
6161

62-
public NotionPropertyNumber(double value, string jsonValue, string downloadedText)
62+
public NotionPropertyNumber(NotionPropertyData data)
6363
{
64-
InternalValue = value;
65-
JsonValue = jsonValue;
66-
DownloadText = downloadedText;
64+
PropertyName = data.propertyName;
65+
InternalValue = double.Parse(data.jsonValue);
66+
JsonValue = data.jsonValue;
67+
DownloadText = data.downloadText;
6768
}
6869
}
6970
}

0 commit comments

Comments
 (0)