Skip to content

Commit

Permalink
Implement Client.pages.properties.retrieve()
Browse files Browse the repository at this point in the history
  • Loading branch information
ramnes committed Dec 4, 2021
1 parent 0dbde96 commit 20705ac
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions notion_client/api_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,26 @@ def update(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
)


class PagesPropertiesEndpoint(Endpoint):
def retrieve(self, page_id: str, property_id: str, **kwargs: Any) -> SyncAsync[Any]:
"""Retrieve a `property_item` object for a given `page_id` and `property_id`.
Depending on the property type, the object returned will either be a value or a
paginated list of property item values.
"""
return self.parent.request(
path=f"pages/{page_id}/properties/{property_id}",
method="GET",
auth=kwargs.get("auth"),
query=pick(kwargs, "start_cursor", "page_size"),
)


class PagesEndpoint(Endpoint):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.properties = PagesPropertiesEndpoint(*args, **kwargs)

def create(self, **kwargs: Any) -> SyncAsync[Any]:
"""Create a new page in the specified database or as a child of an existing page.
Expand Down

0 comments on commit 20705ac

Please sign in to comment.