from ...tl.mtproto_request import MTProtoRequest


class InvokeWithoutUpdatesRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0xbf9459b7

    def __init__(self, query):
        """
        :param query: Telegram type: «X». This should be another MTProtoRequest.

        :returns X: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.query = query

    def on_send(self, writer):
        writer.write_int(InvokeWithoutUpdatesRequest.constructor_id, signed=False)
        self.query.on_send(writer)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return InvokeWithoutUpdatesRequest(None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X'

    def __str__(self):
        return '(invokeWithoutUpdates (ID: 0xbf9459b7) = (query={}))'.format(str(self.query))
