Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Src/Notion.Client/Models/File/ExternalFileWithName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

namespace Notion.Client
{
public class ExternalFileWithName : FileObjectWithName
{
public override string Type => "external";

[JsonProperty("external")]
public Info External { get; set; }

public class Info
{
[JsonProperty("url")]
public string Url { get; set; }
}
}
}
17 changes: 17 additions & 0 deletions Src/Notion.Client/Models/File/FileObjectWithName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using JsonSubTypes;
using Newtonsoft.Json;

namespace Notion.Client
{
[JsonConverter(typeof(JsonSubtypes), "type")]
[JsonSubtypes.KnownSubType(typeof(UploadedFileWithName), "file")]
[JsonSubtypes.KnownSubType(typeof(ExternalFileWithName), "external")]
public abstract class FileObjectWithName
{
[JsonProperty("type")]
public virtual string Type { get; set; }

[JsonProperty("name")]
public string Name { get; set; }
}
}
22 changes: 22 additions & 0 deletions Src/Notion.Client/Models/File/UploadedFileWithName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using Newtonsoft.Json;

namespace Notion.Client
{
public class UploadedFileWithName : FileObjectWithName
{
public override string Type => "file";

[JsonProperty("file")]
public Info File { get; set; }

public class Info
{
[JsonProperty("url")]
public string Url { get; set; }

[JsonProperty("expiry_time")]
public DateTime ExpiryTime { get; set; }
}
}
}
7 changes: 1 addition & 6 deletions Src/Notion.Client/Models/PropertyValue/FilesPropertyValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ public class FilesPropertyValue : PropertyValue
{
public override PropertyValueType Type => PropertyValueType.Files;

public List<FileValue> Files { get; set; }
}

public class FileValue
{
public string Name { get; set; }
public List<FileObjectWithName> Files { get; set; }
}
}