From 96bee247d6a20d9753f13cf232965449e3941c9e Mon Sep 17 00:00:00 2001 From: Alexander PapaTutuWawa Date: Mon, 21 Apr 2025 02:12:04 +0200 Subject: [PATCH] Add more doc strings --- src/xmpp_api/api/bot.py | 46 ++++++++++++++++++++++++++++++++++++++- src/xmpp_api/api/error.py | 6 ----- 2 files changed, 45 insertions(+), 7 deletions(-) delete mode 100644 src/xmpp_api/api/error.py diff --git a/src/xmpp_api/api/bot.py b/src/xmpp_api/api/bot.py index 2891a47..c4b19e8 100644 --- a/src/xmpp_api/api/bot.py +++ b/src/xmpp_api/api/bot.py @@ -4,6 +4,10 @@ from xmpp_api.db.bot import JIDType class BotInformation(BaseModel): + """ + Information about a bot. + """ + # The bot's ID id: str @@ -21,19 +25,38 @@ class BotInformation(BaseModel): class AllowedJidInformation(BaseModel): + """ + Information about an allowed JID + """ + + # The JID that a message would be sent to. jid: str + # The token that the bot must use in order to send + # messages to this JID. token: str -class BotConstraint(BaseModel): ... +class BotConstraint(BaseModel): + """ + Base-class for bot constraints. + """ class BotDomainConstraint(BotConstraint): + """ + Bot constraint that prevents the bot from sending messages to + domains that are not listed in @domains. + """ + domains: list[str] class CreateBotRequest(BaseModel): + """ + Model for a bot creation request. + """ + # The bot's name name: str @@ -48,11 +71,19 @@ class CreateBotRequest(BaseModel): class BotCreationResponse(BotInformation): + """ + The response to a successful bot creation request. + """ + # The bot's token token: str class AddJidRequest(BaseModel): + """ + The request to add a JID to a bot. + """ + # The JID that the message will be sent to jid: str @@ -61,13 +92,26 @@ class AddJidRequest(BaseModel): class AddJidResponse(BaseModel): + """ + The response to a successful JID addition. + """ + + # The token that identifies the previously specified JID. token: str class SendMessageRequest(BaseModel): + """ + Model for the request to send a message to a JID. + """ + # The message content body: str class GetBotInformation(BotInformation): + """ + Response for an information request about a given bot. + """ + jids: list[AllowedJidInformation] diff --git a/src/xmpp_api/api/error.py b/src/xmpp_api/api/error.py deleted file mode 100644 index fa4e6da..0000000 --- a/src/xmpp_api/api/error.py +++ /dev/null @@ -1,6 +0,0 @@ -from pydantic import BaseModel - - -class Error(BaseModel): - # The error message - msg: str