Skip to content

The official Python API wrapper for the Teaház protocol.

Notifications You must be signed in to change notification settings

teahaz/teahaz.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

teahaz.py

PyPI version Pylint

My ad-hoc checklist/API documentation

Note: All endpoint URLs should be used in the form: http(s)://<server_url>/<endpoint>

  • Datatypes

    • Channel:

      • channel_name: str
      • channelID: str,
      • public: bool
      • permissions: dict, items:
        • r: bool
        • w: bool
        • x: bool
    • User:

      • userID: str
      • username: str
      • color: dict, items:
        • r: int
        • g: int
        • b: int
    • Message:

      • messageID: str
      • channelID: str
      • userID: str
      • keyID: str
      • send_time: float
      • type: str
      • data: Union[str, bytes]
    • Invite

      • uid: str
      • uses: int
      • expiration-time: float
      • data: str
  • Chatroom: /chatroom/

    • get: Unknown
    • post:
      • username: str
      • password: str
      • chatroom_name: str
      • -> Create chatroom
    • note: this endpoint does not require chatroom_id
  • Login: /login/<chatroom_id>

    • get:

      • userID: str
      • -> Check if logged in:
        • 200: logged in
        • 401: not logged in
    • post:

      • userID: str
      • password: str
      • -> Return chatroom data
        • chatroomID: str
        • userID: str
        • channels: list[Channel]
    • note: userID to become username in the near future.

  • Users: /users/<chatroom_id>

    • get:
      • userID: str
      • -> Return all users in a chatroom: list[User]
    • post: None
  • Channels: /channels/<chatroom_id>

    • get:
      • userID: str
      • -> Return all channels a user has read-access to: list[Channel]
    • post:
      • userID: str
      • channel_name: str
      • -> Create a chatroom
  • Messages: /messages/<chatroom_id>

    • get:
      • userID: str
      • count: Optional[int] <= 100
      • time: (epoch) Optional[float]
      • get-method: one of ["since", "count"]
      • channelID: Optional[str]
      • -> Get list of messages: list[Message]
    • post
      • userID: str
      • channelID: str
      • replyID: str
      • data: str
      • -> Send a message
    • note: channelID can filter messages by channel
  • Invites: /invites/<chatroom_id>

    • get
      • userID: str
      • uses: Optional[int]
      • expiration-time: (epoch) Optional[float]
      • -> Create an invite
    • post
      • inviteID: str
      • username: str
      • password: str
      • -> Use an invite