Coverage for notion_client / api_endpoints.py: 100%
125 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-12 09:03 +0000
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-12 09:03 +0000
1"""Notion API endpoints.""" # noqa: E501
3from typing import TYPE_CHECKING, Any
5from notion_client.helpers import pick
6from notion_client.typing import SyncAsync
8if TYPE_CHECKING: # pragma: no cover
9 from notion_client.client import BaseClient
12class Endpoint:
13 def __init__(self, parent: "BaseClient") -> None:
14 self.parent = parent
17class BlocksChildrenEndpoint(Endpoint):
18 def append(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
19 """Create and append new children blocks to the block using the ID specified.
21 *[🔗 Endpoint documentation](https://developers.notion.com/reference/patch-block-children)*
22 """ # noqa: E501
23 return self.parent.request(
24 path=f"blocks/{block_id}/children",
25 method="PATCH",
26 body=pick(kwargs, "children", "after", "position"),
27 auth=kwargs.get("auth"),
28 )
30 def list(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
31 """Return a paginated array of child [block objects](https://developers.notion.com/reference/block) contained in the block.
33 *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-block-children)*
34 """ # noqa: E501
35 return self.parent.request(
36 path=f"blocks/{block_id}/children",
37 method="GET",
38 query=pick(kwargs, "start_cursor", "page_size"),
39 auth=kwargs.get("auth"),
40 )
43class BlocksMeetingNotesEndpoint(Endpoint):
44 def query(self, **kwargs: Any) -> SyncAsync[Any]:
45 """Query meeting notes.
47 *[🔗 Endpoint documentation](https://developers.notion.com/reference/query-meeting-notes)*
48 """ # noqa: E501
49 return self.parent.request(
50 path="blocks/meeting_notes/query",
51 method="POST",
52 body=pick(kwargs, "filter", "sort", "limit"),
53 auth=kwargs.get("auth"),
54 )
57class BlocksEndpoint(Endpoint):
58 def __init__(self, *args: Any, **kwargs: Any) -> None:
59 super().__init__(*args, **kwargs)
60 self.children = BlocksChildrenEndpoint(*args, **kwargs)
61 self.meeting_notes = BlocksMeetingNotesEndpoint(*args, **kwargs)
63 def retrieve(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
64 """Retrieve a [Block object](https://developers.notion.com/reference/block) using the ID specified.
66 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-block)*
67 """ # noqa: E501
68 return self.parent.request(
69 path=f"blocks/{block_id}", method="GET", auth=kwargs.get("auth")
70 )
72 def update(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
73 """Update the content for the specified `block_id` based on the block type.
75 *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-block)*
76 """ # noqa: E501
77 return self.parent.request(
78 path=f"blocks/{block_id}",
79 method="PATCH",
80 body=pick(
81 kwargs,
82 "embed",
83 "type",
84 "archived",
85 "in_trash",
86 "bookmark",
87 "image",
88 "video",
89 "pdf",
90 "file",
91 "audio",
92 "code",
93 "equation",
94 "divider",
95 "breadcrumb",
96 "tab",
97 "table_of_contents",
98 "link_to_page",
99 "table_row",
100 "heading_1",
101 "heading_2",
102 "heading_3",
103 "heading_4",
104 "paragraph",
105 "bulleted_list_item",
106 "numbered_list_item",
107 "quote",
108 "to_do",
109 "toggle",
110 "template",
111 "callout",
112 "synced_block",
113 "table",
114 "column",
115 ),
116 auth=kwargs.get("auth"),
117 )
119 def delete(self, block_id: str, **kwargs: Any) -> SyncAsync[Any]:
120 """Set a [Block object](https://developers.notion.com/reference/block), including page blocks, to `archived: true`.
122 *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-a-block)*
123 """ # noqa: E501
124 return self.parent.request(
125 path=f"blocks/{block_id}",
126 method="DELETE",
127 auth=kwargs.get("auth"),
128 )
131class DatabasesEndpoint(Endpoint):
132 def retrieve(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
133 """Retrieves a [database object](https://developers.notion.com/reference/database) for a provided database ID.
135 *[🔗 Endpoint documentation](https://developers.notion.com/reference/database-retrieve)*
136 """ # noqa: E501
137 return self.parent.request(
138 path=f"databases/{database_id}",
139 method="GET",
140 auth=kwargs.get("auth"),
141 )
143 def update(self, database_id: str, **kwargs: Any) -> SyncAsync[Any]:
144 """Update the title or properties of an existing database.
146 *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-database)*
147 """ # noqa: E501
148 return self.parent.request(
149 path=f"databases/{database_id}",
150 method="PATCH",
151 body=pick(
152 kwargs,
153 "parent",
154 "title",
155 "description",
156 "is_inline",
157 "icon",
158 "cover",
159 "in_trash",
160 "is_locked",
161 ),
162 auth=kwargs.get("auth"),
163 )
165 def create(self, **kwargs: Any) -> SyncAsync[Any]:
166 """Create a new database.
168 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-database)*
169 """ # noqa: E501
170 return self.parent.request(
171 path="databases",
172 method="POST",
173 body=pick(
174 kwargs,
175 "parent",
176 "title",
177 "description",
178 "is_inline",
179 "initial_data_source",
180 "icon",
181 "cover",
182 ),
183 auth=kwargs.get("auth"),
184 )
187class DataSourcesEndpoint(Endpoint):
188 def retrieve(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
189 """Retrieve a [data source](https://developers.notion.com/reference/data-source) object for a provided data source ID.
191 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-data-source)*
192 """ # noqa: E501
193 return self.parent.request(
194 path=f"data_sources/{data_source_id}", method="GET", auth=kwargs.get("auth")
195 )
197 def query(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
198 """Get a list of [Pages](https://developers.notion.com/reference/page) and/or [Data Sources](https://developers.notion.com/reference/data-source) contained in the data source.
200 *[🔗 Endpoint documentation](https://developers.notion.com/reference/query-a-data-source)*
201 """ # noqa: E501
202 return self.parent.request(
203 path=f"data_sources/{data_source_id}/query",
204 method="POST",
205 query=pick(kwargs, "filter_properties"),
206 body=pick(
207 kwargs,
208 "sorts",
209 "filter",
210 "start_cursor",
211 "page_size",
212 "archived",
213 "in_trash",
214 "result_type",
215 ),
216 auth=kwargs.get("auth"),
217 )
219 def create(self, **kwargs: Any) -> SyncAsync[Any]:
220 """Add an additional [data source](https://developers.notion.com/reference/data-source) to an existing [database](https://developers.notion.com/reference/database).
222 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-data-source)*
223 """ # noqa: E501
224 return self.parent.request(
225 path="data_sources",
226 method="POST",
227 body=pick(kwargs, "parent", "properties", "title", "icon"),
228 auth=kwargs.get("auth"),
229 )
231 def update(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
232 """Updates the [data source](https://developers.notion.com/reference/data-source) object of a specified data source under a database.
234 *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-data-source)*
235 """ # noqa: E501
236 return self.parent.request(
237 path=f"data_sources/{data_source_id}",
238 method="PATCH",
239 body=pick(
240 kwargs, "title", "icon", "properties", "in_trash", "archived", "parent"
241 ),
242 auth=kwargs.get("auth"),
243 )
245 def list_templates(self, data_source_id: str, **kwargs: Any) -> SyncAsync[Any]:
246 """List page templates that are available for a data source.
248 *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-data-source-templates)*
249 """ # noqa: E501
250 return self.parent.request(
251 path=f"data_sources/{data_source_id}/templates",
252 method="GET",
253 query=pick(kwargs, "name", "start_cursor", "page_size"),
254 auth=kwargs.get("auth"),
255 )
258class PagesPropertiesEndpoint(Endpoint):
259 def retrieve(self, page_id: str, property_id: str, **kwargs: Any) -> SyncAsync[Any]:
260 """Retrieve a `property_item` object for a given `page_id` and `property_id`.
262 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-page-property)*
263 """ # noqa: E501
264 return self.parent.request(
265 path=f"pages/{page_id}/properties/{property_id}",
266 method="GET",
267 auth=kwargs.get("auth"),
268 query=pick(kwargs, "start_cursor", "page_size"),
269 )
272class PagesEndpoint(Endpoint):
273 def __init__(self, *args: Any, **kwargs: Any) -> None:
274 super().__init__(*args, **kwargs)
275 self.properties = PagesPropertiesEndpoint(*args, **kwargs)
277 def create(self, **kwargs: Any) -> SyncAsync[Any]:
278 """Create a new page in the specified database or as a child of an existing page.
280 *[🔗 Endpoint documentation](https://developers.notion.com/reference/post-page)*
281 """ # noqa: E501
282 return self.parent.request(
283 path="pages",
284 method="POST",
285 body=pick(
286 kwargs,
287 "parent",
288 "properties",
289 "icon",
290 "cover",
291 "content",
292 "children",
293 "markdown",
294 "template",
295 "position",
296 ),
297 auth=kwargs.get("auth"),
298 )
300 def retrieve(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
301 """Retrieve a [Page object](https://developers.notion.com/reference/page) using the ID specified.
303 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-page)*
304 """ # noqa: E501
305 return self.parent.request(
306 path=f"pages/{page_id}",
307 method="GET",
308 query=pick(kwargs, "filter_properties"),
309 auth=kwargs.get("auth"),
310 )
312 def update(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
313 """Update [page property values](https://developers.notion.com/reference/page#property-value-object) for the specified page.
315 *[🔗 Endpoint documentation](https://developers.notion.com/reference/patch-page)*
316 """ # noqa: E501
317 return self.parent.request(
318 path=f"pages/{page_id}",
319 method="PATCH",
320 body=pick(
321 kwargs,
322 "properties",
323 "icon",
324 "cover",
325 "is_locked",
326 "template",
327 "erase_content",
328 "archived",
329 "in_trash",
330 ),
331 auth=kwargs.get("auth"),
332 )
334 def retrieve_markdown(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
335 """Retrieve a page as markdown.
337 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-page-markdown)*
338 """ # noqa: E501
339 return self.parent.request(
340 path=f"pages/{page_id}/markdown",
341 method="GET",
342 query=pick(kwargs, "include_transcript"),
343 auth=kwargs.get("auth"),
344 )
346 def update_markdown(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
347 """Update a page's content as markdown.
349 *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-page-markdown)*
350 """ # noqa: E501
351 return self.parent.request(
352 path=f"pages/{page_id}/markdown",
353 method="PATCH",
354 body=pick(
355 kwargs,
356 "type",
357 "insert_content",
358 "replace_content_range",
359 "update_content",
360 "replace_content",
361 ),
362 auth=kwargs.get("auth"),
363 )
365 def move(self, page_id: str, **kwargs: Any) -> SyncAsync[Any]:
366 """Use this API to move an existing Notion page to a new parent.
368 *[🔗 Endpoint documentation](https://developers.notion.com/reference/move-page)*
369 """ # noqa: E501
370 return self.parent.request(
371 path=f"pages/{page_id}/move",
372 method="POST",
373 body=pick(kwargs, "parent"),
374 auth=kwargs.get("auth"),
375 )
378class UsersEndpoint(Endpoint):
379 def list(self, **kwargs: Any) -> SyncAsync[Any]:
380 """Return a paginated list of [Users](https://developers.notion.com/reference/user) for the workspace.
382 *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-users)*
383 """ # noqa: E501
384 return self.parent.request(
385 path="users",
386 method="GET",
387 query=pick(kwargs, "start_cursor", "page_size"),
388 auth=kwargs.get("auth"),
389 )
391 def retrieve(self, user_id: str, **kwargs: Any) -> SyncAsync[Any]:
392 """Retrieve a [User](https://developers.notion.com/reference/user) using the ID specified.
394 *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-user)*
395 """ # noqa: E501
396 return self.parent.request(
397 path=f"users/{user_id}", method="GET", auth=kwargs.get("auth")
398 )
400 def me(self, **kwargs: Any) -> SyncAsync[Any]:
401 """Retrieve the bot [User](https://developers.notion.com/reference/user) associated with the API token.
403 *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-self)*
404 """ # noqa: E501
405 return self.parent.request(
406 path="users/me", method="GET", auth=kwargs.get("auth")
407 )
410class ViewsQueriesEndpoint(Endpoint):
411 def create(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
412 """Create a view query.
414 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-view-query)*
415 """ # noqa: E501
416 return self.parent.request(
417 path=f"views/{view_id}/queries",
418 method="POST",
419 body=pick(kwargs, "page_size"),
420 auth=kwargs.get("auth"),
421 )
423 def results(self, view_id: str, query_id: str, **kwargs: Any) -> SyncAsync[Any]:
424 """Get view query results.
426 *[🔗 Endpoint documentation](https://developers.notion.com/reference/get-view-query-results)*
427 """ # noqa: E501
428 return self.parent.request(
429 path=f"views/{view_id}/queries/{query_id}",
430 method="GET",
431 query=pick(kwargs, "start_cursor", "page_size"),
432 auth=kwargs.get("auth"),
433 )
435 def delete(self, view_id: str, query_id: str, **kwargs: Any) -> SyncAsync[Any]:
436 """Delete a view query.
438 *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-view-query)*
439 """ # noqa: E501
440 return self.parent.request(
441 path=f"views/{view_id}/queries/{query_id}",
442 method="DELETE",
443 auth=kwargs.get("auth"),
444 )
447class ViewsEndpoint(Endpoint):
448 def __init__(self, *args: Any, **kwargs: Any) -> None:
449 super().__init__(*args, **kwargs)
450 self.queries = ViewsQueriesEndpoint(*args, **kwargs)
452 def create(self, **kwargs: Any) -> SyncAsync[Any]:
453 """Create a view.
455 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-view)*
456 """ # noqa: E501
457 return self.parent.request(
458 path="views",
459 method="POST",
460 body=pick(
461 kwargs,
462 "data_source_id",
463 "name",
464 "type",
465 "database_id",
466 "view_id",
467 "filter",
468 "sorts",
469 "quick_filters",
470 "create_database",
471 "configuration",
472 "position",
473 "placement",
474 ),
475 auth=kwargs.get("auth"),
476 )
478 def retrieve(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
479 """Retrieve a view.
481 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-view)*
482 """ # noqa: E501
483 return self.parent.request(
484 path=f"views/{view_id}",
485 method="GET",
486 auth=kwargs.get("auth"),
487 )
489 def update(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
490 """Update a view.
492 *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-a-view)*
493 """ # noqa: E501
494 return self.parent.request(
495 path=f"views/{view_id}",
496 method="PATCH",
497 body=pick(
498 kwargs,
499 "name",
500 "filter",
501 "sorts",
502 "quick_filters",
503 "configuration",
504 ),
505 auth=kwargs.get("auth"),
506 )
508 def delete(self, view_id: str, **kwargs: Any) -> SyncAsync[Any]:
509 """Delete a view.
511 *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-view)*
512 """ # noqa: E501
513 return self.parent.request(
514 path=f"views/{view_id}",
515 method="DELETE",
516 auth=kwargs.get("auth"),
517 )
519 def list(self, **kwargs: Any) -> SyncAsync[Any]:
520 """List views for a database.
522 *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-views)*
523 """ # noqa: E501
524 return self.parent.request(
525 path="views",
526 method="GET",
527 query=pick(
528 kwargs, "database_id", "data_source_id", "start_cursor", "page_size"
529 ),
530 auth=kwargs.get("auth"),
531 )
534class SearchEndpoint(Endpoint):
535 def __call__(self, **kwargs: Any) -> SyncAsync[Any]:
536 """Search all pages and child pages that are shared with the integration.
538 *[🔗 Endpoint documentation](https://developers.notion.com/reference/post-search)*
539 """ # noqa: E501
540 return self.parent.request(
541 path="search",
542 method="POST",
543 body=pick(kwargs, "query", "sort", "filter", "start_cursor", "page_size"),
544 auth=kwargs.get("auth"),
545 )
548class CustomEmojisEndpoint(Endpoint):
549 def list(self, **kwargs: Any) -> SyncAsync[Any]:
550 """List custom emojis.
552 *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-custom-emojis)*
553 """ # noqa: E501
554 return self.parent.request(
555 path="custom_emojis",
556 method="GET",
557 query=pick(kwargs, "start_cursor", "page_size", "name"),
558 auth=kwargs.get("auth"),
559 )
562class CommentsEndpoint(Endpoint):
563 def create(self, **kwargs: Any) -> SyncAsync[Any]:
564 """Create a new comment in the specified page or existing discussion thread.
566 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-comment)*
567 """ # noqa: E501
568 return self.parent.request(
569 path="comments",
570 method="POST",
571 body=pick(
572 kwargs,
573 "attachments",
574 "display_name",
575 "parent",
576 "rich_text",
577 "markdown",
578 "discussion_id",
579 ),
580 auth=kwargs.get("auth"),
581 )
583 def list(self, **kwargs: Any) -> SyncAsync[Any]:
584 """Retrieve a list of un-resolved [Comment objects](https://developers.notion.com/reference/comment-object) from the specified block.
586 *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-comments)*
587 """ # noqa: E501
588 return self.parent.request(
589 path="comments",
590 method="GET",
591 query=pick(kwargs, "block_id", "start_cursor", "page_size"),
592 auth=kwargs.get("auth"),
593 )
595 def retrieve(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
596 """Retrieve a [Comment object](https://developers.notion.com/reference/comment-object) from its `comment_id`.
598 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-comment)*
599 """ # noqa: E501
600 return self.parent.request(
601 path=f"comments/{comment_id}",
602 method="GET",
603 auth=kwargs.get("auth"),
604 )
606 def update(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
607 """Update a [Comment object](https://developers.notion.com/reference/comment-object) using its `comment_id`.
609 *[🔗 Endpoint documentation](https://developers.notion.com/reference/update-comment)*
610 """ # noqa: E501
611 return self.parent.request(
612 path=f"comments/{comment_id}",
613 method="PATCH",
614 body=pick(kwargs, "rich_text", "markdown"),
615 auth=kwargs.get("auth"),
616 )
618 def delete(self, comment_id: str, **kwargs: Any) -> SyncAsync[Any]:
619 """Delete a [Comment object](https://developers.notion.com/reference/comment-object) using its `comment_id`.
621 *[🔗 Endpoint documentation](https://developers.notion.com/reference/delete-comment)*
622 """ # noqa: E501
623 return self.parent.request(
624 path=f"comments/{comment_id}",
625 method="DELETE",
626 auth=kwargs.get("auth"),
627 )
630class FileUploadsEndpoint(Endpoint):
631 def create(self, **kwargs: Any) -> SyncAsync[Any]:
632 """Create a file upload.
634 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-file-upload)*
635 """ # noqa: E501
636 return self.parent.request(
637 path="file_uploads",
638 method="POST",
639 body=pick(
640 kwargs,
641 "mode",
642 "filename",
643 "content_type",
644 "number_of_parts",
645 "external_url",
646 ),
647 auth=kwargs.get("auth"),
648 )
650 def complete(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
651 """Complete the file upload process.
653 *[🔗 Endpoint documentation](https://developers.notion.com/reference/complete-a-file-upload)*
654 """ # noqa: E501
655 return self.parent.request(
656 path=f"file_uploads/{file_upload_id}/complete",
657 method="POST",
658 auth=kwargs.get("auth"),
659 )
661 def retrieve(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
662 """Retrieve a file upload object using the ID specified.
664 *[🔗 Endpoint documentation](https://developers.notion.com/reference/retrieve-a-file-upload)*
665 """ # noqa: E501
666 return self.parent.request(
667 path=f"file_uploads/{file_upload_id}",
668 method="GET",
669 auth=kwargs.get("auth"),
670 )
672 def list(self, **kwargs: Any) -> SyncAsync[Any]:
673 """List all file uploads.
675 *[🔗 Endpoint documentation](https://developers.notion.com/reference/list-file-uploads)*
676 """ # noqa: E501
677 return self.parent.request(
678 path="file_uploads",
679 method="GET",
680 query=pick(kwargs, "status", "start_cursor", "page_size"),
681 auth=kwargs.get("auth"),
682 )
684 def send(self, file_upload_id: str, **kwargs: Any) -> SyncAsync[Any]:
685 """Send a file upload
687 *[🔗 Endpoint documentation](https://developers.notion.com/reference/send-a-file-upload)*
688 """ # noqa: E501
689 return self.parent.request(
690 path=f"file_uploads/{file_upload_id}/send",
691 method="POST",
692 form_data=pick(kwargs, "file", "part_number"),
693 auth=kwargs.get("auth"),
694 )
697class OAuthEndpoint(Endpoint):
698 def token(
699 self, client_id: str, client_secret: str, **kwargs: Any
700 ) -> SyncAsync[Any]:
701 """Create an access token that a third-party service can use to authenticate with Notion.
703 *[🔗 Endpoint documentation](https://developers.notion.com/reference/create-a-token)*
704 """ # noqa: E501
705 return self.parent.request(
706 path="oauth/token",
707 method="POST",
708 body=pick(
709 kwargs,
710 "grant_type",
711 "code",
712 "redirect_uri",
713 "external_account",
714 "refresh_token",
715 ),
716 auth={"client_id": client_id, "client_secret": client_secret},
717 )
719 def introspect(
720 self, client_id: str, client_secret: str, **kwargs: Any
721 ) -> SyncAsync[Any]:
722 """Get a token's active status, scope, and issued time.
724 *[🔗 Endpoint documentation](https://developers.notion.com/reference/introspect-token)*
725 """ # noqa: E501
726 return self.parent.request(
727 path="oauth/introspect",
728 method="POST",
729 body=pick(kwargs, "token"),
730 auth={"client_id": client_id, "client_secret": client_secret},
731 )
733 def revoke(
734 self, client_id: str, client_secret: str, **kwargs: Any
735 ) -> SyncAsync[Any]:
736 """Revoke an access token.
738 *[🔗 Endpoint documentation](https://developers.notion.com/reference/revoke-token)*
739 """ # noqa: E501
740 return self.parent.request(
741 path="oauth/revoke",
742 method="POST",
743 body=pick(kwargs, "token"),
744 auth={"client_id": client_id, "client_secret": client_secret},
745 )