# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from yandex.cloud.ai.assistants.v1.runs import run_pb2 as yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2
from yandex.cloud.ai.assistants.v1.runs import run_service_pb2 as yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2

GRPC_GENERATED_VERSION = '1.70.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in yandex/cloud/ai/assistants/v1/runs/run_service_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class RunServiceStub(object):
    """RunService provides operations for managing runs.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Create = channel.unary_unary(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/Create',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.CreateRunRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.FromString,
                _registered_method=True)
        self.Listen = channel.unary_stream(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/Listen',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListenRunRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.StreamEvent.FromString,
                _registered_method=True)
        self.Attach = channel.stream_stream(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/Attach',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.AttachRunRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.StreamEvent.FromString,
                _registered_method=True)
        self.Get = channel.unary_unary(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/Get',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.GetRunRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.FromString,
                _registered_method=True)
        self.GetLastByThread = channel.unary_unary(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/GetLastByThread',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.GetLastRunByThreadRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.FromString,
                _registered_method=True)
        self.List = channel.unary_unary(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/List',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListRunsRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListRunsResponse.FromString,
                _registered_method=True)
        self.Submit = channel.unary_unary(
                '/yandex.cloud.ai.assistants.v1.runs.RunService/Submit',
                request_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.SubmitToRunRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.SubmitToRunResponse.FromString,
                _registered_method=True)


class RunServiceServicer(object):
    """RunService provides operations for managing runs.
    """

    def Create(self, request, context):
        """Create a new run for a given assistant and thread.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Listen(self, request, context):
        """Listen to events from a specific run.
        If the run was created with `stream = false`, Listen will only respond with the final status of the run
        and will not stream partial messages or intermediate events.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Attach(self, request_iterator, context):
        """Bi-directional streaming method to interact with a specific run.
        Like `Listen`, `Attach` streams events from the run, but also allows clients to send events back.
        For example, it can be used to submit function call results when the run is waiting for user input.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Get(self, request, context):
        """Retrieve details of a specific run by its ID.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetLastByThread(self, request, context):
        """Retrieves the most recent run for a specific thread.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def List(self, request, context):
        """List runs in a specific folder.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Submit(self, request, context):
        """Submit event to run
        For example, submit function call results when the run is waiting for user input.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_RunServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Create': grpc.unary_unary_rpc_method_handler(
                    servicer.Create,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.CreateRunRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.SerializeToString,
            ),
            'Listen': grpc.unary_stream_rpc_method_handler(
                    servicer.Listen,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListenRunRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.StreamEvent.SerializeToString,
            ),
            'Attach': grpc.stream_stream_rpc_method_handler(
                    servicer.Attach,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.AttachRunRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.StreamEvent.SerializeToString,
            ),
            'Get': grpc.unary_unary_rpc_method_handler(
                    servicer.Get,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.GetRunRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.SerializeToString,
            ),
            'GetLastByThread': grpc.unary_unary_rpc_method_handler(
                    servicer.GetLastByThread,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.GetLastRunByThreadRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.SerializeToString,
            ),
            'List': grpc.unary_unary_rpc_method_handler(
                    servicer.List,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListRunsRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListRunsResponse.SerializeToString,
            ),
            'Submit': grpc.unary_unary_rpc_method_handler(
                    servicer.Submit,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.SubmitToRunRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.SubmitToRunResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.ai.assistants.v1.runs.RunService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('yandex.cloud.ai.assistants.v1.runs.RunService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class RunService(object):
    """RunService provides operations for managing runs.
    """

    @staticmethod
    def Create(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/Create',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.CreateRunRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Listen(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/Listen',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListenRunRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.StreamEvent.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Attach(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/Attach',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.AttachRunRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.StreamEvent.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Get(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/Get',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.GetRunRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetLastByThread(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/GetLastByThread',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.GetLastRunByThreadRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__pb2.Run.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def List(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/List',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListRunsRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.ListRunsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Submit(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.ai.assistants.v1.runs.RunService/Submit',
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.SubmitToRunRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_assistants_dot_v1_dot_runs_dot_run__service__pb2.SubmitToRunResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
