File tree Expand file tree Collapse file tree 3 files changed +59
-2
lines changed
Expand file tree Collapse file tree 3 files changed +59
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ protected function fillFromRaw(): void
6969 {
7070 $ this ->fillId ();
7171 $ this ->fillType ();
72- $ this ->fillContent ();
72+ $ this ->fillRawContent ();
7373 $ this ->fillHasChildren ();
7474 $ this ->fillCreatedTime ();
7575 $ this ->fillLastEditedTime ();
@@ -88,7 +88,7 @@ private function fillType(): void
8888 /**
8989 *
9090 */
91- private function fillContent (): void
91+ private function fillRawContent (): void
9292 {
9393 if (Arr::exists ($ this ->responseData , $ this ->getType ())) {
9494 $ this ->rawContent = $ this ->responseData [$ this ->getType ()];
@@ -193,6 +193,7 @@ private static function mapTypeToClass(string $type): string
193193 case 'child_page ' :
194194 case 'paragraph ' :
195195 case 'to_do ' :
196+ case 'embed ' :
196197 case 'toggle ' :
197198 $ class = str_replace ('_ ' , '' , ucwords ($ type , '_ ' ));
198199 return "FiveamCode \\LaravelNotionApi \\Entities \\Blocks \\" . $ class ;
Original file line number Diff line number Diff line change 1313 */
1414class ChildPage extends Block
1515{
16+ function __construct (array $ responseData = null ){
17+ $ this ->type = "child_page " ;
18+ parent ::__construct ($ responseData );
19+ }
20+
1621 /**
1722 *
1823 */
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace FiveamCode \LaravelNotionApi \Entities \Blocks ;
4+
5+ use DateTime ;
6+ use Illuminate \Support \Arr ;
7+ use FiveamCode \LaravelNotionApi \Entities \Entity ;
8+ use FiveamCode \LaravelNotionApi \Entities \PropertyItems \RichText ;
9+ use FiveamCode \LaravelNotionApi \Exceptions \HandlingException ;
10+
11+ /**
12+ * Class Paragraph
13+ * @package FiveamCode\LaravelNotionApi\Entities\Blocks
14+ */
15+ class Embed extends Block
16+ {
17+ private RichText $ caption ;
18+ private string $ url = "" ;
19+
20+ function __construct (array $ responseData = null ){
21+ $ this ->type = "embed " ;
22+ parent ::__construct ($ responseData );
23+ }
24+
25+ /**
26+ *
27+ */
28+ protected function fillFromRaw (): void
29+ {
30+ parent ::fillFromRaw ();
31+ $ this ->fillContent ();
32+ }
33+
34+ /**
35+ *
36+ */
37+ protected function fillContent (): void
38+ {
39+ $ this ->url = $ this ->rawContent ['url ' ];
40+ $ this ->caption = new RichText ($ this ->rawContent ['caption ' ]);
41+ $ this ->content = $ this ->url ;
42+ }
43+
44+ public function getUrl (){
45+ return $ this ->url ;
46+ }
47+
48+ public function getCaption (){
49+ return $ this ->caption ;
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments