8000 Removed 'archived' property and added 'in_trash' property. · notion-dotnet/notion-sdk-net@08ed291 · GitHub
[go: up one dir, main page]

Skip to content

Commit 08ed291

Browse files
Removed 'archived' property and added 'in_trash' property.
1 parent 5e0882b commit 08ed291

36 files changed

+61
-53
lines changed

Src/Notion.Client/Api/Blocks/IBlocksClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Task<AppendChildrenResponse> AppendChildrenAsync(
4747
);
4848

4949
/// <summary>
50-
/// Sets a Block object, including page blocks, to archived: true using the ID specified.
50+
/// Moves a Block object, including page blocks, to the trash: true using the ID specified.
5151
/// </summary>
5252
/// <param name="blockId">Identifier for a Notion block</param>
5353
Task DeleteAsync(string blockId, CancellationToken cancellationToken = default);

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BookmarkUpdateBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class BookmarkUpdateBlock : IUpdateBlock
88
[JsonProperty("bookmark")]
99
public Info Bookmark { get; set; }
1010

11-
public bool Archived { get; set; }
11+
public bool InTrash { get; set; }
1212

1313
public class Info
1414
{

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BreadcrumbUpdateBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public BreadcrumbUpdateBlock()
1212
[JsonProperty("breadcrumb")]
1313
public Info Breadcrumb { get; set; }
1414

15-
public bool Archived { get; set; }
15+
public bool InTrash { get; set; }
1616

1717
public class Info
1818
{

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/DividerUpdateBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public DividerUpdateBlock()
1212
[JsonProperty("divider")]
1313
public Info Divider { get; set; }
1414

15-
public bool Archived { get; set; }
15+
public bool InTrash { get; set; }
1616

1717
public class Info
1818
{

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/IUpdateBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Notion.Client
44
{
55
public interface IUpdateBlock
66
{
7-
[JsonProperty("archived")]
8-
bool Archived { get; set; }
7+
[JsonProperty("in_trash")]
8+
bool InTrash { get; set; }
99
}
1010
}

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableOfContentsUpdateBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public TableOfContentsUpdateBlock()
1212
[JsonProperty("table_of_contents")]
1313
public Info TableOfContents { get; set; }
1414

15-
public bool Archived { get; set; }
15+
public bool InTrash { get; set; }
1616

1717
public class Info
1818
{

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/UpdateBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
{
33
public abstract class UpdateBlock : IUpdateBlock
44
{
5-
public bool Archived { get; set; }
5+
public bool InTrash { get; set; }
66
}
77
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class DatabasesUpdateParameters : IDatabasesUpdateBodyParameters
1212

1313
public FileObject Cover { get; set; }
1414

15-
public bool Archived { get; set; }
15+
public bool InTrash { get; set; }
1616

1717
public bool? IsInline { get; set; }
1818

Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/IDatabasesUpdateBodyParameters.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public interface IDatabasesUpdateBodyParameters
1717
[JsonProperty("cover")]
1818
FileObject Cover { get; set; }
1919

20-
[JsonProperty("archived")]
21-
bool Archived { get; set; }
20+
[JsonProperty("in_trash")]
21+
bool InTrash { get; set; }
2222

2323
[JsonProperty("is_inline")]
2424
bool? IsInline { get; set; }

Src/Notion.Client/Api/Pages/RequestParams/IPagesUpdateBodyParameters.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ namespace Notion.Client
55
{
66
public interface IPagesUpdateBodyParameters
77
{
8-
[JsonProperty("archived")]
9-
bool Archived { get; set; }
8+
[JsonProperty("in_trash")]
9+
bool InTrash { get; set; }
1010

1111
[JsonProperty("properties")]
1212
IDictionary<string, PropertyValue> Properties { get; set; }

Src/Notion.Client/Api/Pages/RequestParams/PagesUpdateParameters.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class PagesUpdateParameters : IPagesUpdateBodyParameters
1111
[JsonProperty("cover")]
1212
public FileObject Cover { get; set; }
1313

14-
[JsonProperty("archived")]
15-
public bool Archived { get; set; }
14+
[JsonProperty("in_trash")]
15+
public bool InTrash { get; set; }
1616

1717
[JsonProperty("properties")]
1818
public IDictionary<string, PropertyValue> Properties { get; set; }

Src/Notion.Client/Models/Blocks/Block.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public abstract class Block : IBlock
1616

1717
public virtual bool HasChildren { get; set; }
1818

19+
public bool InTrash { get; set; }
20+
1921
public PartialUser CreatedBy { get; set; }
2022

2123
public PartialUser LastEditedBy { get; set; }

Src/Notion.Client/Models/Blocks/IBlock.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public interface IBlock : IObject, IObjectModificationData
4747
[JsonProperty("has_children")]
4848
bool HasChildren { get; set; }
4949

50+
[JsonProperty("in_trash")]
51+
bool InTrash { get; set; }
52+
5053
[JsonProperty("parent")]
5154
IBlockParent Parent { get; set; }
5255
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
2727
[JsonProperty("url")]
2828
public string Url { get; set; }
2929

30-
/// <summary>
31-
/// The archived status of the database.
32-
/// </summary>
33-
[JsonProperty("archived")]
34-
public bool Archived { get; set; }
30+
[JsonProperty("in_trash")]
31+
public bool InTrash { get; set; }
3532

3633
[JsonProperty("is_inline")]
3734
public bool IsInline { get; set; }

Src/Notion.Client/Models/Page/Page.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public class Page : IObject, IObjectModificationData, IWikiDatabase
1313
public IPageParent Parent { get; set; }
1414

1515
/// <summary>
16-
/// The archived status of the page.
16+
/// Indicates whether the page is currently in the trash.
1717
/// </summary>
18-
[JsonProperty("archived")]
19-
public bool IsArchived { get; set; }
18+
[JsonProperty("in_trash")]
19+
public bool InTrash { get; set; }
2020

2121
/// <summary>
2222
/// Property values of this page.

Test/Notion.IntegrationTests/BlocksClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task InitializeAsync()
2323

2424
public async Task DisposeAsync()
2525
{
26-
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
26+
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { InTrash = true });
2727
}
2828

2929
[Fact]

Test/Notion.IntegrationTests/CommentsClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task InitializeAsync()
2121

2222
public async Task DisposeAsync()
2323
{
24-
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
24+
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { InTrash = true });
2525
}
2626

2727
[Fact]

Test/Notion.IntegrationTests/DatabasesClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task InitializeAsync()
2222

2323
public async Task DisposeAsync()
2424
{
25-
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
25+
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { InTrash = true });
2626
}
2727

2828
[Fact]

Test/Notion.IntegrationTests/PageClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public async Task InitializeAsync()
6363

6464
public async Task DisposeAsync()
6565
{
66-
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
66+
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { InTrash = true });
6767
}
6868

6969
[Fact]

Test/Notion.IntegrationTests/PageWithPageParentTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public async Task InitializeAsync()
2929

3030
public async Task DisposeAsync()
3131
{
32-
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
32+
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { InTrash = true });
3333
}
3434

3535
[Fact]

Test/Notion.UnitTests/BlocksClientTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public async Task UpdateAsync()
184184

185185
block.Id.Should().Be(blockId);
186186
block.HasChildren.Should().BeFalse();
187+
block.InTrash.Should().BeFalse();
187188
block.Type.Should().Be(BlockType.ToDo);
188189

189190
var todoBlock = (ToDoBlock)block;

Test/Notion.UnitTests/Notion.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<None Update="data\databases\UpdateDatabaseResponse.json">
5252
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5353
</None>
54-
<None Update="data\pages\ArchivePageResponse.json">
54+
<None Update="data\pages\TrashPageResponse.json">
5555
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5656
</None>
5757
<None Update="data\pages\CreatePageResponse.json">

Test/Notion.UnitTests/PagesClientTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public async Task RetrieveAsync()
3939
page.Id.Should().Be(pageId);
4040
page.Parent.Type.Should().Be(ParentType.DatabaseId);
4141
((DatabaseParent)page.Parent).DatabaseId.Should().Be("48f8fee9-cd79-4180-bc2f-ec0398253067");
42-
page.IsArchived.Should().BeFalse();
42+
page.InTrash.Should().BeFalse();
4343
}
4444

4545
[Fact]
@@ -72,7 +72,7 @@ public async Task CreateAsync()
7272
page.Url.Should().NotBeNullOrEmpty();
7373
page.Properties.Should().HaveCount(1);
7474
page.Properties.First().Key.Should().Be("Name");
75-
page.IsArchived.Should().BeFalse();
75+
page.InTrash.Should().BeFalse();
7676
page.Parent.Should().NotBeNull();
7777
((DatabaseParent)page.Parent).DatabaseId.Should().Be("3c357473-a281-49a4-88c0-10d2b245a589");
7878
}
@@ -172,7 +172,7 @@ public async Task UpdatePageAsync()
172172
var page = await _client.UpdateAsync(pageId, pagesUpdateParameters);
173173

174174
page.Id.Should().Be(pageId);
175-
page.IsArchived.Should().BeFalse();
175+
page.InTrash.Should().BeFalse();
176176
page.Properties.Should().HaveCount(2);
177177
var updatedProperty = page.Properties.First(x => x.Key == "In stock");
178178

@@ -187,14 +187,14 @@ public async Task UpdatePageAsync()
187187
}
188188

189189
[Fact]
190-
public async Task ArchivePageAsync()
190+
public async Task TrashPageAsync()
191191
{
192192
var pageId = "251d2b5f-268c-4de2-afe9-c71ff92ca95c";
193193
var propertyId = "{>U;";
194194

195195
var path = ApiEndpoints.PagesApiUrls.UpdateProperties(pageId);
196196

197-
var jsonData = await File.ReadAllTextAsync("data/pages/ArchivePageResponse.json");
197+
var jsonData = await File.ReadAllTextAsync("data/pages/TrashPageResponse.json");
198198

199199
Server.Given(CreatePatchRequestBuilder(path))
200200
.RespondWith(
@@ -211,7 +211,7 @@ public async Task ArchivePageAsync()
211211

212212
var pagesUpdateParameters = new PagesUpdateParameters
213213
{
214-
Archived = true,
214+
InTrash = true,
215215
Properties = new Dictionary<string, PropertyValue>
216216
{
217217
{ "In stock", new CheckboxPropertyValue { Checkbox = true } }
@@ -221,7 +221,7 @@ public async Task ArchivePageAsync()
221221
var page = await _client.UpdateAsync(pageId, pagesUpdateParameters);
222222

223223
page.Id.Should().Be(pageId);
224-
page.IsArchived.Should().BeTrue();
224+
page.InTrash.Should().BeTrue();
225225
page.Properties.Should().HaveCount(2);
226226
var updatedProperty = page.Properties.First(x => x.Key == "In stock");
227227

Test/Notion.UnitTests/SearchClientTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async Task Search()
5959
obj.Object.Should().Be(ObjectType.Page);
6060

6161
var page = (Page)obj;
62-
page.IsArchived.Should().BeFalse();
62+
page.InTrash.Should().BeFalse();
6363
page.Properties.Should().HaveCount(1);
6464
page.Parent.Should().BeAssignableTo<DatabaseParent>();
6565
((DatabaseParent)page.Parent).DatabaseId.Should().Be("e6c6f8ff-c70e-4970-91ba-98f03e0d7fc6");

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"created_time": "2021-03-16T16:31:00.000Z",
88
"last_edited_time": "2021-03-16T16:32:00.000Z",
99
"has_children": false,
10+
"in_trash" : false,
1011
"type": "heading_2",
1112
"heading_2": {
1213
"rich_text": [

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"created_time": "2021-05-29T16:22:00.000Z",
88
"last_edited_time": "2021-05-29T16:22:00.000Z",
99
"has_children": false,
10-
"archived": false,
10+
"in_trash": false,
1111
"type": "paragraph",
1212
"paragraph": {
1313
"rich_text": []
@@ -19,7 +19,7 @@
1919
"created_time": "2021-05-30T09:25:00.000Z",
2020
"last_edited_time": "2021-05-30T09:25:00.000Z",
2121
"has_children": false,
22-
"archived": false,
22+
"in_trash": false,
2323
"type": "heading_2",
2424
"heading_2": {
2525
"rich_text": [
@@ -49,7 +49,7 @@
4949
"created_time": "2021-05-30T09:36:00.000Z",
5050
"last_edited_time": "2021-05-30T09:36:00.000Z",
5151
"has_children": false,
52-
"archived": false,
52+
"in_trash": false,
5353
"type": "heading_2",
5454
"heading_2": {
5555
"rich_text": [
@@ -79,7 +79,7 @@
7979
"created_time": "2021-08-18T21:12:00.000Z",
8080
"last_edited_time": "2021-08-18T21:12:00.000Z",
8181
"has_children": false,
82-
"archived": false,
82+
"in_trash": false,
8383
"type": "paragraph",
8484
"paragraph": {
8585
"rich_text": []
@@ -91,7 +91,7 @@
9191
"created_time": "2021-08-18T23:00:00.000Z",
9292
"last_edited_time": "2021-08-18T23:00:00.000Z",
9393
"has_children": false,
94-
"archived": false,
94+
"in_trash": false,
9595
"type": "child_page",
9696
"child_page": {
9797
"title": ""
@@ -103,7 +103,7 @@
103103
"created_time": "2021-08-18T23:00:00.000Z",
104104
"last_edited_time": "2021-08-18T23:00:00.000Z",
105105
"has_children": false,
106-
"archived": false,
106+
"in_trash": false,
107107
"type": "child_page",
108108
"child_page": {
109109
"title": ""
@@ -115,7 +115,7 @@
115115
"created_time": "2021-09-09T05:22:00.000Z",
116116
"last_edited_time": "2021-09-09T05:22:00.000Z",
117117
"has_children": false,
118-
"archived": false,
118+
"in_trash": false,
119119
"type": "paragraph",
120120
"paragraph": {
121121
"rich_text": []
@@ -127,7 +127,7 @@
127127
"created_time": "2022-05-03T13:28:00.000Z",
128128
"last_edited_time": "2022-05-03T13:29:00.000Z",
129129
"has_children": false,
130-
"archived": false,
130+
"in_trash": false,
131131
"type": "image",
132132
"image": {
133133
"caption": [
@@ -174,7 +174,7 @@
174174
"id": "92e803ec-193c-4bcd-b28e-88365858d562"
175175
},
176176
"has_children": true,
177-
"archived": false,
177+
"in_trash": false,
178178
"type": "synced_block",
179179
"synced_block": {
180180
"synced_from": {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"created_time": "2021-03-16T16:31:00.000Z",
55
"last_edited_time": "2021-03-16T16:32:00.000Z",
66
"has_children": false,
7+
"in_trash" : false,
78
"type": "to_do",
89
"to_do": {
910
"rich_text": [

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"created_time": "2021-03-16T16:31:00.000Z",
55
"last_edited_time": "2021-03-16T16:32:00.000Z",
66
"has_children": false,
7+
"in_trash" : false,
78
"type": "to_do",
89
"to_do": {
910
"rich_text": [

Test/Notion.UnitTests/data/databases/DatabaseRetrieveResponse.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
}
3434
},
3535
"url": "https://www.notion.so/668d797c76fa49349b05ad288df2d136",
36+
"in_trash" : false,
3637
"properties": {
3738
"Tags": {
3839
"id": "YG~h",

0 commit comments

Comments
 (0)
0