File tree Expand file tree Collapse file tree 5 files changed +55
-0
lines changed
Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks
Test/Notion.IntegrationTests Expand file tree Collapse file tree 5 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ using Newtonsoft . Json ;
2
+
3
+ namespace Notion . Client
4
+ {
5
+ public class LinkToPageUpdateBlock : UpdateBlock , IUpdateBlock
6
+ {
7
+ [ JsonProperty ( "link_to_page" ) ]
8
+ public IPageParentInput LinkToPage { get ; set ; }
9
+ }
10
+ }
Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ public enum BlockType
85
85
[ EnumMember ( Value = "template" ) ]
86
86
Template ,
87
87
88
+ [ EnumMember ( Value = "link_to_page" ) ]
89
+ LinkToPage ,
90
+
88
91
[ EnumMember ( Value = "unsupported" ) ]
89
92
Unsupported
90
93
}
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ namespace Notion.Client
23
23
[ JsonSubtypes . KnownSubType ( typeof ( HeadingTwoBlock ) , BlockType . Heading_2 ) ]
24
24
[ JsonSubtypes . KnownSubType ( typeof ( HeadingThreeeBlock ) , BlockType . Heading_3 ) ]
25
25
[ JsonSubtypes . KnownSubType ( typeof ( ImageBlock ) , BlockType . Image ) ]
26
+ [ JsonSubtypes . KnownSubType ( typeof ( LinkToPageBlock ) , BlockType . LinkToPage ) ]
26
27
[ JsonSubtypes . KnownSubType ( typeof ( NumberedListItemBlock ) , BlockType . NumberedListItem ) ]
27
28
[ JsonSubtypes . KnownSubType ( typeof ( ParagraphBlock ) , BlockType . Paragraph ) ]
28
29
[ JsonSubtypes . KnownSubType ( typeof ( PDFBlock ) , BlockType . PDF ) ]
Original file line number Diff line number Diff line change
1
+ using Newtonsoft . Json ;
2
+
3
+ namespace Notion . Client
4
+ {
5
+ public class LinkToPageBlock : Block , IColumnChildrenBlock , INonColumnBlock
6
+ {
7
+ public override BlockType Type => BlockType . LinkToPage ;
8
+
9
+ [ JsonProperty ( "link_to_page" ) ]
10
+ public IPageParent LinkToPage { get ; set ; }
11
+ }
12
+ }
Original file line number Diff line number Diff line change @@ -506,6 +506,35 @@ private static IEnumerable<object[]> BlockData()
506
506
Assert . Null ( templateBlock . Template . Children ) ;
507
507
Assert . Equal ( "Test Template 2" , templateBlock . Template . Text . OfType < RichTextText > ( ) . First ( ) . Text . Content ) ;
508
508
} )
509
+ } ,
510
+ new object [ ]
511
+ {
512
+ new LinkToPageBlock ( )
513
+ {
514
+ LinkToPage = new PageParent
515
+ {
516
+ Type = ParentType . PageId ,
517
+ PageId = "533578e3edf14c0a91a9da6b09bac3ee"
518
+ }
519
+ } ,
520
+ new LinkToPageUpdateBlock ( )
521
+ {
522
+ LinkToPage = new ParentPageInput
523
+ {
524
+ PageId = "3c357473a28149a488c010d2b245a589"
525
+ }
526
+ } ,
527
+ new Action < IBlock > ( block =>
528
+ {
529
+ Assert . NotNull ( block ) ;
530
+ var linkToPageBlock = Assert . IsType < LinkToPageBlock > ( block ) ;
531
+
532
+ var pageParent = Assert . IsType < PageParent > ( linkToPageBlock . LinkToPage ) ;
533
+
534
+ // TODO: Currently the api doesn't allow to update the link_to_page block type
535
+ // This will change to updated ID once api start to support
536
+ Assert . Equal ( Guid . Parse ( "533578e3edf14c0a91a9da6b09bac3ee" ) , Guid . Parse ( pageParent . PageId ) ) ;
537
+ } )
509
538
}
510
539
} ;
511
540
}
You can’t perform that action at this time.
0 commit comments