예제 #1
0
 def get_file_upload_url(self, size, crc, file_type, is_server=False,
                         success_callback=None, failure_callback=None, **kwargs):
     request_body = GetFileUploadUrl(size, crc, file_type, is_server)
     request = Request(service=ServiceType.Files, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #2
0
 def get_file_download_url(self, file_id, user_id, file_type, file_version=1, is_server=False,
                           is_resume_upload=False, success_callback=None, failure_callback=None, **kwargs):
     request_body = GetFileDownloadUrl(file_id, user_id, file_type, file_version, is_server, is_resume_upload)
     request = Request(service=ServiceType.Files, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #3
0
 def get_file_upload_url(self, size, crc, file_type, is_server=False,
                         success_callback=None, failure_callback=None, **kwargs):
     request_body = GetFileUploadUrl(size, crc, file_type, is_server)
     request = Request(service=ServiceType.Files, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #4
0
 def get_file_download_url(self, file_id, user_id, file_type, file_version=1, is_server=False,
                           is_resume_upload=False, success_callback=None, failure_callback=None, **kwargs):
     request_body = GetFileDownloadUrl(file_id, user_id, file_type, file_version, is_server, is_resume_upload)
     request = Request(service=ServiceType.Files, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #5
0
 def edit_message(self, message, user_peer, random_id, success_callback=None, failure_callback=None,
                  **kwargs):
     text_message = message
     receiver = user_peer
     request_body = EditMessage(updated_message=text_message, peer=receiver, random_id=random_id)
     request = Request(service=ServiceType.Messaging, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #6
0
 def send_message(self, message, peer, quoted_message=None, random_id=None, success_callback=None,
                  failure_callback=None, **kwargs):
     receiver = peer
     request_body = SendMessage(message=message, receiver_peer=receiver,
                                quoted_message=quoted_message, random_id=random_id)
     request = Request(service=ServiceType.Messaging, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #7
0
 def edit_message(self, message, user_peer, random_id, success_callback=None, failure_callback=None,
                  **kwargs):
     text_message = message
     receiver = user_peer
     request_body = EditMessage(updated_message=text_message, peer=receiver, random_id=random_id)
     request = Request(service=ServiceType.Messaging, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #8
0
 def invite_user(self, group_peer_id, group_peer_access_hash, user_peer_id,
                 user_peer_access_hash, success_callback=None, failure_callback=None, **kwargs):
     group_peer = GroupPeer(peer_id=group_peer_id, access_hash=group_peer_access_hash)
     user_peer = UserPeer(peer_id=user_peer_id, access_hash=user_peer_access_hash)
     request_body = InviteUser(group_peer=group_peer, user_peer=user_peer)
     request = Request(service=ServiceType.Groups, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #9
0
 def invite_user(self, group_peer_id, group_peer_access_hash, user_peer_id,
                 user_peer_access_hash, success_callback=None, failure_callback=None, **kwargs):
     group_peer = GroupPeer(peer_id=group_peer_id, access_hash=group_peer_access_hash)
     user_peer = UserPeer(peer_id=user_peer_id, access_hash=user_peer_access_hash)
     request_body = InviteUser(group_peer=group_peer, user_peer=user_peer)
     request = Request(service=ServiceType.Groups, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #10
0
 def send_message(self, message, peer, quoted_message=None, random_id=None, success_callback=None,
                  failure_callback=None, **kwargs):
     receiver = peer
     request_body = SendMessage(message=message, receiver_peer=receiver,
                                quoted_message=quoted_message, random_id=random_id)
     request = Request(service=ServiceType.Messaging, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #11
0
 def create_group(self,
                  title,
                  success_callback=None,
                  failure_callback=None,
                  **kwargs):
     request_body = CreateGroup(title)
     request = Request(service=ServiceType.Groups, body=request_body)
     self.set_future(request.id, request_body, success_callback,
                     failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #12
0
 def get_last_seq(self,
                  success_callback=None,
                  failure_callback=None,
                  **kwargs):
     request_body = GetLastSequence()
     request = Request(service=ServiceType.SequenceUpdate,
                       body=request_body)
     self.set_future(request.id, request_body, success_callback,
                     failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #13
0
 def get_group_api_struct(self,
                          group_id,
                          client_user_id,
                          success_callback=None,
                          failure_callback=None,
                          **kwargs):
     request_body = GetGroupApiStruct(group_id=group_id,
                                      client_user_id=client_user_id)
     request = Request(service=ServiceType.Groups, body=request_body)
     self.set_future(request.id, request_body, success_callback,
                     failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #14
0
 def get_difference(self,
                    seq,
                    how_many,
                    success_callback=None,
                    failure_callback=None,
                    **kwargs):
     request_body = GetDifference(seq=seq, how_many=how_many)
     request = Request(service=ServiceType.SequenceUpdate,
                       body=request_body)
     self.set_future(request.id, request_body, success_callback,
                     failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #15
0
 def create_group(self, title, success_callback=None, failure_callback=None, **kwargs):
     request_body = CreateGroup(title)
     request = Request(service=ServiceType.Groups, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #16
0
 def get_last_seq(self, success_callback=None, failure_callback=None, **kwargs):
     request_body = GetLastSequence()
     request = Request(service=ServiceType.SequenceUpdate, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #17
0
 def get_difference(self, seq, how_many, success_callback=None, failure_callback=None, **kwargs):
     request_body = GetDifference(seq=seq, how_many=how_many)
     request = Request(service=ServiceType.SequenceUpdate, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request
예제 #18
0
 def get_group_api_struct(self, group_id, client_user_id, success_callback=None, failure_callback=None, **kwargs):
     request_body = GetGroupApiStruct(group_id=group_id, client_user_id=client_user_id)
     request = Request(service=ServiceType.Groups, body=request_body)
     self.set_future(request.id, request_body, success_callback, failure_callback, **kwargs)
     self.send_request(request.get_json_str())
     return request