Skip to content

Conversation

@johguentner
Copy link
Member

  • add easy content and text access for rich-text- (all supported blocks, exept page-blocks) and child-page-blocks
  • add fromResponse- and mapTypeToClass-method to Block::class (similar to the implementations within Property::class)

- add easy content and text access for rich-text- (all supported blocks, exept page-blocks) and child-page-blocks
- add fromResponse- and mapTypeToClass-method to Block::class (similar to the implementations within Property::class)
@johguentner johguentner requested a review from mechelon June 26, 2021 21:14
check if correct instance is added to collection (depending on block type)
check if content of blocks is correctly retreived
$class = str_replace('_', '', ucwords($type, '_'));
return "FiveamCode\\LaravelNotionApi\\Entities\\Blocks\\" . $class;
case 'heading_1':
return "FiveamCode\\LaravelNotionApi\\Entities\\Blocks\\HeadingOne";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HeadingOne::class

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done

{
private bool $showUnsupported = false;

public function withUnsupported(): BlockCollection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO-Di: Add PhpDoc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done

return $collection;
} else {
return $collection->filter(function($block){
return $block->getType() != 'unsupported';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe !== here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done


public function asCollection(): Collection
{
$collection =parent::asCollection();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done

public function asJson(): string
{
return $this->collection->map(function (Entity $item) {
return $this->asCollection()->map(function (Entity $item) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document this in the Changelog, it's not really breaking but somehow... changed 🤔

Http::fake([
'https://api.notion.com/v1/blocks/1d719dd1-563b-4387-b74f-20da92b827fb/children*'
=> Http::response(
json_decode(file_get_contents('tests/stubs/endpoints/blocks/response_specific_supported_blocks_200.json'), true),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check indentation to be sure

Copy link
Member Author

@johguentner johguentner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied all necessary changes

$class = str_replace('_', '', ucwords($type, '_'));
return "FiveamCode\\LaravelNotionApi\\Entities\\Blocks\\" . $class;
case 'heading_1':
return "FiveamCode\\LaravelNotionApi\\Entities\\Blocks\\HeadingOne";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done

{
private bool $showUnsupported = false;

public function withUnsupported(): BlockCollection
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done


public function asCollection(): Collection
{
$collection =parent::asCollection();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done

return $collection;
} else {
return $collection->filter(function($block){
return $block->getType() != 'unsupported';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ done

Copy link
Member Author

@johguentner johguentner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked

@johguentner johguentner merged commit 367cd32 into dev Aug 21, 2021
@mechelon mechelon deleted the feature/blocks branch June 17, 2022 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants