Skip to content

Commit ba59ee0

Browse files
Merge pull request #234 from winl-2022/add_caption_to_file_block
add caption property in file block
2 parents 94206fe + 682dc0c commit ba59ee0

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

Src/Notion.Client/Models/File/FileObject.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using JsonSubTypes;
1+
using System.Collections.Generic;
2+
using JsonSubTypes;
23
using Newtonsoft.Json;
34

45
namespace Notion.Client
@@ -10,5 +11,8 @@ public abstract class FileObject : IPageIcon
1011
{
1112
[JsonProperty("type")]
1213
public virtual string Type { get; set; }
14+
15+
[JsonProperty("caption")]
16+
public IEnumerable<RichTextBase> Caption { get; set; }
1317
}
1418
}

Test/Notion.UnitTests/BlocksClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public async Task RetrieveBlockChildren()
3838

3939
// Assert
4040
var children = childrenResult.Results;
41-
children.Should().HaveCount(7);
41+
children.Should().HaveCount(8);
4242
}
4343

4444
[Fact]

Test/Notion.UnitTests/data/blocks/RetrieveBlockChildrenResponse.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,41 @@
120120
"paragraph": {
121121
"text": []
122122
}
123+
},
124+
{
125+
"object": "block",
126+
"id": "ABD0E698-ABE6-42F2-80B1-24497AAE16F1",
127+
"created_time": "2022-05-03T13:28:00.000Z",
128+
"last_edited_time": "2022-05-03T13:29:00.000Z",
129+
"has_children": false,
130+
"archived": false,
131+
"type": "image",
132+
"image": {
133+
"caption": [
134+
{
135+
"type": "text",
136+
"text": {
137+
"content": "caption text",
138+
"link": null
139+
},
140+
"annotations": {
141+
"bold": false,
142+
"italic": false,
143+
"strikethrough": false,
144+
"underline": false,
145+
"code": false,
146+
"color": "default"
147+
},
148+
"plain_text": "caption text",
149+
"href": null
150+
}
151+
],
152+
"type": "file",
153+
"file": {
154+
"url": "https://s3.us-west-2.amazonaws.com/secure.notion-static.com/xxx",
155+
"expiry_time": "2022-05-11T17:55:32.613Z"
156+
}
157+
}
123158
}
124159
],
125160
"next_cursor": null,

0 commit comments

Comments
 (0)