Closed johguentner closed 1 year ago
Hey @farez,
just wanted to double check, if this goes into the direction you hoped regarding database creation (example of current possibilities with these new changes):
$databaseEntity = Notion::databases()
->build()
->inline() // just don't use, if you want it to be as subpage
->title('Title of Database')
->addTitleProperty() // required (that's why it's an extra function for ease of use)
->addProperty('Description', PropertyBuilder::richText())
->addProperty('Number', PropertyBuilder::number('dollar'))
->addRawProperty('Special Property', [ /* raw for unsupported/future properties */ ])
->createInPage('2c682e7372ec4399be1cc015686c69c6');
Hello Johannes!
Ah that looks awesome. Should work well.
An idea: have a shortcut method called addProperties() that takes an array of property definitions. Saves calling addProperty lots of times.
Thanks man. Look forward to using this.
Farez
On Fri, 28 Apr 2023, 22:58 JohGuentner, @.***> wrote:
Hey @farez https://github.com/farez,
just wanted to double check, if this goes into the direction you hoped regarding database creation (example of current possibilities with these new changes):
$databaseEntity = Notion::databases() ->build() ->inline() // just don't use, if you want it to be as subpage ->title('Title of Database') ->addTitleProperty() // required (that's why it's an extra function for ease of use) ->addProperty('Description', PropertyBuilder::richText()) ->addProperty('Number', PropertyBuilder::number('dollar')) ->addRawProperty('Special Property', [ / raw for unsupported/future properties / ]) ->createInPage('2c682e7372ec4399be1cc015686c69c6');
— Reply to this email directly, view it on GitHub https://github.com/5am-code/laravel-notion-api/pull/135#issuecomment-1527695438, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAJVUPT2C6OJGD52DV4YBDXDPLHVANCNFSM6AAAAAAXPK57TA . You are receiving this because you were mentioned.Message ID: @.***>
Hello Johannes! Ah that looks awesome. Should work well. An idea: have a shortcut method called addProperties() that takes an array of property definitions. Saves calling addProperty lots of times. Thanks man. Look forward to using this. Farez
Thank you for your input @farez !
I updated the description above to show all possibilities.
After I add the final touches + especially testing, I'll push this as v1.1.0
Adding multiple ways to create a new database within the Notion API
To keep it a bit more similar to Laravel migrations, it's also possible to do it like this:
To keep things simple, it's also possible to use the
PropertyBuilder::class
.Polish of
PestHttpRecorder::class