This commit is contained in:
parent
a214864010
commit
96bee247d6
@ -4,6 +4,10 @@ from xmpp_api.db.bot import JIDType
|
|||||||
|
|
||||||
|
|
||||||
class BotInformation(BaseModel):
|
class BotInformation(BaseModel):
|
||||||
|
"""
|
||||||
|
Information about a bot.
|
||||||
|
"""
|
||||||
|
|
||||||
# The bot's ID
|
# The bot's ID
|
||||||
id: str
|
id: str
|
||||||
|
|
||||||
@ -21,19 +25,38 @@ class BotInformation(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class AllowedJidInformation(BaseModel):
|
class AllowedJidInformation(BaseModel):
|
||||||
|
"""
|
||||||
|
Information about an allowed JID
|
||||||
|
"""
|
||||||
|
|
||||||
|
# The JID that a message would be sent to.
|
||||||
jid: str
|
jid: str
|
||||||
|
|
||||||
|
# The token that the bot must use in order to send
|
||||||
|
# messages to this JID.
|
||||||
token: str
|
token: str
|
||||||
|
|
||||||
|
|
||||||
class BotConstraint(BaseModel): ...
|
class BotConstraint(BaseModel):
|
||||||
|
"""
|
||||||
|
Base-class for bot constraints.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class BotDomainConstraint(BotConstraint):
|
class BotDomainConstraint(BotConstraint):
|
||||||
|
"""
|
||||||
|
Bot constraint that prevents the bot from sending messages to
|
||||||
|
domains that are not listed in @domains.
|
||||||
|
"""
|
||||||
|
|
||||||
domains: list[str]
|
domains: list[str]
|
||||||
|
|
||||||
|
|
||||||
class CreateBotRequest(BaseModel):
|
class CreateBotRequest(BaseModel):
|
||||||
|
"""
|
||||||
|
Model for a bot creation request.
|
||||||
|
"""
|
||||||
|
|
||||||
# The bot's name
|
# The bot's name
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
@ -48,11 +71,19 @@ class CreateBotRequest(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class BotCreationResponse(BotInformation):
|
class BotCreationResponse(BotInformation):
|
||||||
|
"""
|
||||||
|
The response to a successful bot creation request.
|
||||||
|
"""
|
||||||
|
|
||||||
# The bot's token
|
# The bot's token
|
||||||
token: str
|
token: str
|
||||||
|
|
||||||
|
|
||||||
class AddJidRequest(BaseModel):
|
class AddJidRequest(BaseModel):
|
||||||
|
"""
|
||||||
|
The request to add a JID to a bot.
|
||||||
|
"""
|
||||||
|
|
||||||
# The JID that the message will be sent to
|
# The JID that the message will be sent to
|
||||||
jid: str
|
jid: str
|
||||||
|
|
||||||
@ -61,13 +92,26 @@ class AddJidRequest(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class AddJidResponse(BaseModel):
|
class AddJidResponse(BaseModel):
|
||||||
|
"""
|
||||||
|
The response to a successful JID addition.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# The token that identifies the previously specified JID.
|
||||||
token: str
|
token: str
|
||||||
|
|
||||||
|
|
||||||
class SendMessageRequest(BaseModel):
|
class SendMessageRequest(BaseModel):
|
||||||
|
"""
|
||||||
|
Model for the request to send a message to a JID.
|
||||||
|
"""
|
||||||
|
|
||||||
# The message content
|
# The message content
|
||||||
body: str
|
body: str
|
||||||
|
|
||||||
|
|
||||||
class GetBotInformation(BotInformation):
|
class GetBotInformation(BotInformation):
|
||||||
|
"""
|
||||||
|
Response for an information request about a given bot.
|
||||||
|
"""
|
||||||
|
|
||||||
jids: list[AllowedJidInformation]
|
jids: list[AllowedJidInformation]
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class Error(BaseModel):
|
|
||||||
# The error message
|
|
||||||
msg: str
|
|
Loading…
Reference in New Issue
Block a user