You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Access: $page->getTitle(), $page->getContent(), $page->getChildPages(), etc.
222
226
```
223
227
228
+
## Page Size & Pagination
229
+
230
+
The Notion API limits responses to 100 blocks per request. This package handles pagination automatically, allowing you to fetch more blocks seamlessly.
-**Page size > 100**: Automatic pagination with multiple requests
271
+
272
+
The returned data always has a consistent structure:
273
+
274
+
```php
275
+
[
276
+
'results' => [...], // Array of blocks
277
+
'has_more' => bool, // Whether more items exist
278
+
'next_cursor' => ?string // Cursor for manual continuation (null if results were trimmed)
279
+
]
280
+
```
281
+
282
+
> **Note**: When results are trimmed to meet your requested limit, `next_cursor` is set to `null` to prevent accidentally skipping items. The `has_more` flag will still indicate if more items exist.
283
+
284
+
### Validation
285
+
286
+
Page size must be a positive integer. Invalid values will throw an exception:
287
+
288
+
```php
289
+
// These will throw InvalidArgumentException:
290
+
MdNotion::make($pageId)->content()->read(0); // Zero not allowed
291
+
MdNotion::make($pageId)->content()->read(-5); // Negative not allowed
292
+
```
293
+
294
+
## Error Handling
295
+
296
+
The package provides a dedicated `NotionApiException` for handling Notion API errors with detailed information.
297
+
298
+
### Basic Error Handling
299
+
300
+
```php
301
+
use Redberry\MdNotion\Facades\MdNotion;
302
+
use Redberry\MdNotion\SDK\Exceptions\NotionApiException;
The `MdNotion` package provides rich object models for working with Notion pages and databases. Both `Page` and `Database` objects extend `BaseObject` and use several traits to provide comprehensive functionality.
0 commit comments