igf_api_py_client/entities/TgBot.py
2024-12-22 14:10:39 +03:00

27 lines
786 B
Python

from igf_api.BaseEntity import BaseEntity
class TgBot(BaseEntity):
def get_list(self):
return self.connection.raw_request(method='get', endpoint='/tg-bot')
def create(self, data):
schema = {
'type': 'object',
'properties': {
'bot_id': {'type': 'integer'},
'dialog_id': {'type': 'integer'},
'username': {'type': 'string'},
'first_name': {'type': 'string'},
'last_name': {'type': 'string'},
'status': {'type': 'integer'},
},
'required': ['dialog_id', 'bot_id']
}
if self.validate_dict(data, schema):
return self.connection.raw_request('post', '/tg-bot', data=data)
return False