This commit is contained in:
		
							parent
							
								
									a214864010
								
							
						
					
					
						commit
						96bee247d6
					
				| @ -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] | ||||
|  | ||||
| @ -1,6 +0,0 @@ | ||||
| from pydantic import BaseModel | ||||
| 
 | ||||
| 
 | ||||
| class Error(BaseModel): | ||||
|     # The error message | ||||
|     msg: str | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user