Skip to content

Commit

Permalink
feat: add types for users responses
Browse files Browse the repository at this point in the history
  • Loading branch information
guacs committed Sep 12, 2023
1 parent 1a8bdd4 commit 46a481a
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions notion_client/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""The types for the various responses."""

from typing import Any, Literal, TypedDict


class EmptyObject(TypedDict):
...


# ---------- User ----------


class PersonDetails(TypedDict):
email: str | None


class PersonUserObjectResponse(TypedDict):
type: Literal["person"]
person: PersonDetails
name: str | None
avatar_url: str | None
id: str
object: Literal["user"]


class WorkspaceOwner(TypedDict):
type: Literal["workspace"]
workspace: Literal[True]


class BotDetails(TypedDict):
owner: PersonUserObjectResponse | WorkspaceOwner
workspace_name: str | None


class BotUserObjectResponse(TypedDict):
type: Literal["bot"]
bot: EmptyObject | BotDetails
name: str | None
avatar_url: str | None
id: str
object: Literal["user"]


UserObjectResponse = PersonUserObjectResponse | BotUserObjectResponse


# ---------- Block ----------
BlockObjectResponse = Any

# ---------- Database ---------
DatabaseObjectResponse = Any

# ---------- Page ----------
PageObjectResponse = Any

0 comments on commit 46a481a

Please sign in to comment.