first
This commit is contained in:
26
igf_api/entities/TgBot.py
Normal file
26
igf_api/entities/TgBot.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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
|
Reference in New Issue
Block a user