Skip to content

Commit db005a0

Browse files
Merge pull request #139 from notion-dotnet/bfix/138-add-type-and-name-when-updating-database
Add `type` and `name` to property when updating database
2 parents 0078ef3 + 657615d commit db005a0

18 files changed

+60
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class CheckboxUpdatePropertySchema : IUpdatePropertySchema
6+
public class CheckboxUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("checkbox")]
79
public Dictionary<string, object> Checkbox { get; set; }
810
}
911
}

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedByUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class CreatedByUpdatePropertySchema : IUpdatePropertySchema
6+
public class CreatedByUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
77
{
88
[JsonProperty("created_by")]
99
public Dictionary<string, object> CreatedBy { get; set; }

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedTimeUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class CreatedTimeUpdatePropertySchema : IUpdatePropertySchema
6+
public class CreatedTimeUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
77
{
88
[JsonProperty("created_time")]
99
public Dictionary<string, object> CreatedTime { get; set; }
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class DateUpdatePropertySchema : IUpdatePropertySchema
6+
public class DateUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("date")]
79
public Dictionary<string, object> Date { get; set; }
810
}
911
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class EmailUpdatePropertySchema : IUpdatePropertySchema
6+
public class EmailUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("email")]
79
public Dictionary<string, object> Email { get; set; }
810
}
911
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class FilesUpdatePropertySchema : IUpdatePropertySchema
6+
public class FilesUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("file")]
79
public Dictionary<string, object> File { get; set; }
810
}
911
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
namespace Notion.Client
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
24
{
3-
public class FormulaUpdatePropertySchema : IUpdatePropertySchema
5+
public class FormulaUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
46
{
7+
[JsonProperty("checkbox")]
58
public Formula Formula { get; set; }
69
}
710
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1-
namespace Notion.Client
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
4+
namespace Notion.Client
25
{
36
public interface IUpdatePropertySchema
47
{
8+
[JsonProperty("name")]
9+
string Name { get; set; }
10+
11+
[JsonProperty("type")]
12+
[JsonConverter(typeof(StringEnumConverter))]
13+
PropertyType? Type { get; set; }
14+
}
15+
16+
public abstract class UpdatePropertySchema : IUpdatePropertySchema
17+
{
18+
public string Name { get; set; }
19+
20+
public PropertyType? Type { get; set; }
521
}
622
}

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedByUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class LastEditedByUpdatePropertySchema : IUpdatePropertySchema
6+
public class LastEditedByUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
77
{
88
[JsonProperty("last_edited_by")]
99
public Dictionary<string, object> LastEditedBy { get; set; }

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedTimeUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class LastEditedTimeUpdatePropertySchema : IUpdatePropertySchema
6+
public class LastEditedTimeUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
77
{
88
[JsonProperty("last_edited_time")]
99
public Dictionary<string, object> LastEditedTime { get; set; }

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/MultiSelectUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Notion.Client
44
{
5-
public class MultiSelectUpdatePropertySchema : IUpdatePropertySchema
5+
public class MultiSelectUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
66
{
77
[JsonProperty("multi_select")]
88
public OptionWrapper<SelectOption> MultiSelect { get; set; }
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
namespace Notion.Client
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
24
{
3-
public class NumberUpdatePropertySchema : IUpdatePropertySchema
5+
public class NumberUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
46
{
7+
[JsonProperty("number")]
58
public Number Number { get; set; }
69
}
710
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class PeopleUpdatePropertySchema : IUpdatePropertySchema
6+
public class PeopleUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("people")]
79
public Dictionary<string, object> People { get; set; }
810
}
911
}

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PhoneNumberUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class PhoneNumberUpdatePropertySchema : IUpdatePropertySchema
6+
public class PhoneNumberUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
77
{
88
[JsonProperty("phone_number")]
99
public Dictionary<string, object> PhoneNumber { get; set; }

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RichTextUpdatePropertySchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class RichTextUpdatePropertySchema : IUpdatePropertySchema
6+
public class RichTextUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
77
{
88
[JsonProperty("rich_text")]
99
public Dictionary<string, object> RichText { get; set; }
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
namespace Notion.Client
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
24
{
3-
public class SelectUpdatePropertySchema : IUpdatePropertySchema
5+
public class SelectUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
46
{
7+
[JsonProperty("select")]
58
public OptionWrapper<SelectOption> Select { get; set; }
69
}
710
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class TitleUpdatePropertySchema : IUpdatePropertySchema
6+
public class TitleUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("title")]
79
public Dictionary<string, object> Title { get; set; }
810
}
911
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
5-
public class URLUpdatePropertySchema : IUpdatePropertySchema
6+
public class URLUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema
67
{
8+
[JsonProperty("url")]
79
public Dictionary<string, object> Url { get; set; }
810
}
911
}

0 commit comments

Comments
 (0)