Skip to content

💡 [REQUEST] - Expose parameters to create page with icon/cover and update multiple properties at once, reducing API calls #144

@ivanlonel

Description

@ivanlonel

Describe your use-case or problem

The ultimate-notion high level API doesn't have a Page.update or Session.update_page or Database.update_page or Schema.update method, to allow updating the values of multiple properties of a page at once. When I want to update all properties of a page (which I read from another source, like a CSV or another web API), I need to use the setter for each property for each page I want to update (which uses more API calls and therefore takes longer) or use the obj_api directly, as PagesEndpoint does have an update method that accepts a dict of properties.

And even the obj_api create/update methods don't take advantage of the fact that the notion-sdk-py's underlying create/update methods accept icon and cover as parameters, which allows setting both in the same API call used to create the page or update it.

Proposed solution / feature

  1. Include update methods in the high level API that use the obj_apis PagesEndpoint.update` method, allowing to update all properties of a page with a single API call.

  2. Expose icon and cover parameters from notion-sdk-py's PagesEndpoint methods to the obj_api 'create' and 'update' methods, and then to the high level API methods that use them.

Additional context or examples

Exposing 'icon' and 'cover' parameters would allow the application to trade this:

page = my_schema.create(**my_properties)
page.icon = icon  # separate API call
page.cover = cover  # separate API call

for this:

page = my_schema.create(**my_properties, icon=icon, cover=cover)

Also, implementing methods to update all properties of a page at once would allow the application to trade this:

page.props.p0 = my_properties["p0"]
page.props.p1 = my_properties["p1"]
page.props.p2 = my_properties["p2"]
page.props.p3 = my_properties["p3"]
page.props.p4 = my_properties["p4"]
page.props.p5 = my_properties["p5"]
page.props.p6 = my_properties["p6"]
page.props.p7 = my_properties["p7"]
page.props.p8 = my_properties["p8"]
page.props.p9 = my_properties["p9"]
...
page.props.pn = my_properties["pn"]
page.icon = icon
page.cover = cover

for this:

 my_schema.update(page, **my_properties, icon=icon, cover=cover)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions