Skip to content

Commit d4a34bc

Browse files
Merge branch '2.0.0' into tech/141-add-json-property-attributes-to-all-api-response-and-request-model
2 parents 807707c + 4fa6bf5 commit d4a34bc

File tree

8 files changed

+64
-6
lines changed

8 files changed

+64
-6
lines changed

Src/Notion.Client/Models/Database/Database.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@ public class Database : IObject
3030

3131
[JsonProperty("cover")]
3232
public FileObject Cover { get; set; }
33+
34+
/// <summary>
35+
/// The URL of the Notion database.
36+
/// </summary>
37+
[JsonProperty("url")]
38+
public string Url { get; set; }
3339
}
3440
}
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
@@ -14,11 +14,6 @@ public class FilesPropertyValue : PropertyValue
1414
/// Array of File Object with name.
1515
/// </summary>
1616
[JsonProperty("files")]
17-
public List<FileValue> Files { get; set; }
18-
}
19-
20-
public class FileValue
21-
{
22-
public string Name { get; set; }
17+
public List<FileObjectWithName> Files { get; set; }
2318
}
2419
}

0 commit comments

Comments
 (0)