# 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 canvas_generated.messages import events_pb2 as canvas__generated_dot_messages_dot_events__pb2
from canvas_generated.messages import plugins_pb2 as canvas__generated_dot_messages_dot_plugins__pb2

GRPC_GENERATED_VERSION = '1.78.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},'
        + ' but the generated code in canvas_generated/services/plugin_runner_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 PluginRunnerStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.HandleEvent = channel.unary_stream(
                '/canvas.PluginRunner/HandleEvent',
                request_serializer=canvas__generated_dot_messages_dot_events__pb2.Event.SerializeToString,
                response_deserializer=canvas__generated_dot_messages_dot_events__pb2.EventResponse.FromString,
                _registered_method=True)
        self.ReloadPlugins = channel.unary_stream(
                '/canvas.PluginRunner/ReloadPlugins',
                request_serializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginsRequest.SerializeToString,
                response_deserializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginsResponse.FromString,
                _registered_method=True)
        self.ReloadPlugin = channel.unary_stream(
                '/canvas.PluginRunner/ReloadPlugin',
                request_serializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginRequest.SerializeToString,
                response_deserializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginResponse.FromString,
                _registered_method=True)
        self.UnloadPlugin = channel.unary_stream(
                '/canvas.PluginRunner/UnloadPlugin',
                request_serializer=canvas__generated_dot_messages_dot_plugins__pb2.UnloadPluginRequest.SerializeToString,
                response_deserializer=canvas__generated_dot_messages_dot_plugins__pb2.UnloadPluginResponse.FromString,
                _registered_method=True)


class PluginRunnerServicer(object):
    """Missing associated documentation comment in .proto file."""

    def HandleEvent(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReloadPlugins(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReloadPlugin(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UnloadPlugin(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PluginRunnerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'HandleEvent': grpc.unary_stream_rpc_method_handler(
                    servicer.HandleEvent,
                    request_deserializer=canvas__generated_dot_messages_dot_events__pb2.Event.FromString,
                    response_serializer=canvas__generated_dot_messages_dot_events__pb2.EventResponse.SerializeToString,
            ),
            'ReloadPlugins': grpc.unary_stream_rpc_method_handler(
                    servicer.ReloadPlugins,
                    request_deserializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginsRequest.FromString,
                    response_serializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginsResponse.SerializeToString,
            ),
            'ReloadPlugin': grpc.unary_stream_rpc_method_handler(
                    servicer.ReloadPlugin,
                    request_deserializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginRequest.FromString,
                    response_serializer=canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginResponse.SerializeToString,
            ),
            'UnloadPlugin': grpc.unary_stream_rpc_method_handler(
                    servicer.UnloadPlugin,
                    request_deserializer=canvas__generated_dot_messages_dot_plugins__pb2.UnloadPluginRequest.FromString,
                    response_serializer=canvas__generated_dot_messages_dot_plugins__pb2.UnloadPluginResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'canvas.PluginRunner', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('canvas.PluginRunner', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class PluginRunner(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def HandleEvent(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,
            '/canvas.PluginRunner/HandleEvent',
            canvas__generated_dot_messages_dot_events__pb2.Event.SerializeToString,
            canvas__generated_dot_messages_dot_events__pb2.EventResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReloadPlugins(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,
            '/canvas.PluginRunner/ReloadPlugins',
            canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginsRequest.SerializeToString,
            canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReloadPlugin(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,
            '/canvas.PluginRunner/ReloadPlugin',
            canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginRequest.SerializeToString,
            canvas__generated_dot_messages_dot_plugins__pb2.ReloadPluginResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def UnloadPlugin(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,
            '/canvas.PluginRunner/UnloadPlugin',
            canvas__generated_dot_messages_dot_plugins__pb2.UnloadPluginRequest.SerializeToString,
            canvas__generated_dot_messages_dot_plugins__pb2.UnloadPluginResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
