From 20705ac665810669c0738166b16ab76ef1b805b7 Mon Sep 17 00:00:00 2001 From: ramnes Date: Sat, 4 Dec 2021 22:01:33 +0100 Subject: [PATCH] Implement Client.pages.properties.retrieve() --- notion_client/api_endpoints.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/notion_client/api_endpoints.py b/notion_client/api_endpoints.py index b01c2006..f39b93d0 100644 --- a/notion_client/api_endpoints.py +++ b/notion_client/api_endpoints.py @@ -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.