Skip to content

Commit 19487c3

Browse files
Merge pull request #151 from notion-dotnet/feature/148-update-file-page-property
Update file page property
2 parents 846272e + 8be01ee commit 19487c3

File tree

7 files changed

+58
-6
lines changed

7 files changed

+58
-6
lines changed
File renamed without changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class ExternalFileWithName : FileObjectWithName
6+
{
7+
public override string Type => "external";
8+
9+
[JsonProperty("external")]
10+
public Info External { get; set; }
11+
12+
public class Info
13+
{
14+
[JsonProperty("url")]
15+
public string Url { get; set; }
16+
}
17+
}
18+
}
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using JsonSubTypes;
2+
using Newtonsoft.Json;
3+
4+
namespace Notion.Client
5+
{
6+
[JsonConverter(typeof(JsonSubtypes), "type")]
7+
[JsonSubtypes.KnownSubType(typeof(UploadedFileWithName), "file")]
8+
[JsonSubtypes.KnownSubType(typeof(ExternalFileWithName), "external")]
9+
public abstract class FileObjectWithName
10+
{
11+
[JsonProperty("type")]
12+
public virtual string Type { get; set; }
13+
14+
[JsonProperty("name")]
15+
public string Name { get; set; }
16+
}
17+
}
File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Notion.Client
5+
{
6+
public class UploadedFileWithName : FileObjectWithName
7+
{
8+
public override string Type => "file";
9+
10+
[JsonProperty("file")]
11+
public Info File { get; set; }
12+
13+
public class Info
14+
{
15+
[JsonProperty("url")]
16+
public string Url { get; set; }
17+
18+
[JsonProperty("expiry_time")]
19+
public DateTime ExpiryTime { get; set; }
20+
}
21+
}
22+
}

Src/Notion.Client/Models/PropertyValue/FilesPropertyValue.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ public class FilesPropertyValue : PropertyValue
66
{
77
public override PropertyValueType Type => PropertyValueType.Files;
88

9-
public List<FileValue> Files { get; set; }
10-
}
11-
12-
public class FileValue
13-
{
14-
public string Name { get; set; }
9+
public List<FileObjectWithName> Files { get; set; }
1510
}
1611
}

0 commit comments

Comments
 (0)