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
-[No results returned when attempting to get a page](#no-results-returned-when-attempting-to-get-a-page)
27
+
-[Retrieve a full-page Collection View](#retrieve-a-full-page-collection-view)
23
28
24
29
## Getting Started
25
30
### Installation
@@ -60,6 +65,8 @@ The following attributes can be read from any block class instance:
60
65
To update the title of the page:
61
66

62
67
68
+
## Retrieving a CollectionView Page
69
+
This is achieved by passing the ID of the Collection View to the `get_page` method. Currently, the full URL of a Collection View Page is not supported (next up on the features list!). Once you retrieve the Collection View Page, all of the methods exposed to a normal Collection View instance are available (such as `.rows`, `.row(<row_id>)`, and all else outlined in [Updating a Collection](#updating-collection-view-cells)).
63
70
## Retrieving a Block within the Page
64
71
Now that you have retrieved a Notion Page, you have full access to the blocks on that page. You can retrieve a specific block or collection view, retrieve all children IDs (array of children IDs), or retrieve all children (array of children class instances).
65
72
@@ -268,6 +275,28 @@ The first argument passed to `create_collection` determines which type of collec
268
275
4. timeline
269
276
5. gallery
270
277
278
+
## Updating Collection View Cells
279
+
When you retrieve a `CollectionViewRow` instance with `.row(<row_id>)` or a list of `CollectionViewRow` instances with `.rows`, a handful of methods are created. Each row instance has access attributes that represent the properties in the Notion Collection View. So, let's say we are working with the following Notion Collection View:
| 😉 | "winking face" | "Smileys & Emotion" | "wink" | "flirt" | "updated version here!" | "I was updated too!" |
295
+
296
+
You can also add new rows with the `.add_row({<data!>})` method and add new properties with the `.add_property("name_of_property", "type_of_property")` method.
297
+
298
+
**One important thing to be aware of:**
299
+
When adding a row with `.add_row`, the hash of data passed must be in the same order as it appears in your Notion Collection View.
271
300
## Troubleshooting
272
301
### No results returned when attempting to get a page
273
302
If an empty hash is returned when you attempt to retrieve a Notion page, you'll need to include the `x-notion-active-user-header` when instantiating the Notion Client.
@@ -280,4 +309,9 @@ From here, you can instantiate the Notion Client with the following code:
280
309
"<insert_x_notion_active_user_header_here>"
281
310
)
282
311
```
283
-
312
+
### Retrieve a full-page Collection View
313
+
Currently, either a "normal" Page URL or the Page Block ID is accepted to the `get_page` method. Therefore, if you pass the full URL to the CV Table, it will raise an error:
314
+
```text
315
+
the URL or ID passed to the get_page method must be that of a Page Block.
316
+
```
317
+
To avoid this, you must pass only the ID of the full-page collection-view to the `get_page` method. This is next up on the features list, so passing the full URL will be supported soon:smile:
# p row_data["value"]["properties"][column_mappings[i]], !(row_data["value"]["properties"][column] or row_data["value"]["properties"][column_mappings[i]])
0 commit comments