Skip to content

Commit 4424297

Browse files
authored
feat: Add update database endpoint to clients (#2)
1 parent 52ed20f commit 4424297

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

notion/endpoints/asynchronous.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ async def retrieve(self, database_id: str, **kwargs) -> Database:
109109
)
110110
)
111111

112+
async def update(self, database_id: str, **kwargs) -> Database:
113+
return Database.parse_obj(
114+
await self.client.request(
115+
method="PATCH",
116+
path="/databases/{id}".format(id=database_id),
117+
auth=kwargs.get("auth", None),
118+
body=pick(kwargs, "properties", "title"),
119+
)
120+
)
121+
112122

113123
class PagesAsyncEndpoint(AsyncEndpoint):
114124
async def create(self, **kwargs) -> Page:

notion/endpoints/sync.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ def retrieve(self, database_id: str, **kwargs) -> Database:
109109
)
110110
)
111111

112+
def update(self, database_id: str, **kwargs) -> Database:
113+
return Database.parse_obj(
114+
self.client.request(
115+
method="PATCH",
116+
path="/databases/{id}".format(id=database_id),
117+
auth=kwargs.get("auth", None),
118+
body=pick(kwargs, "properties", "title"),
119+
)
120+
)
121+
112122

113123
class PagesEndpoint(Endpoint):
114124
def create(self, **kwargs) -> Page:

0 commit comments

Comments
 (0)