27 lines
786 B
Python
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
|