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

from iotics.api import common_pb2 as iotics_dot_api_dot_common__pb2
from iotics.api import search_pb2 as iotics_dot_api_dot_search__pb2


class SearchAPIStub(object):
    """---------------------------------------------------------------------------------------------------------------------

    SearchAPI provides a set of services to run synchronous and asynchronous search.
    Services only affect local resources, unless stated otherwise.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.DispatchSearchRequest = channel.unary_unary(
                '/iotics.api.SearchAPI/DispatchSearchRequest',
                request_serializer=iotics_dot_api_dot_search__pb2.SearchRequest.SerializeToString,
                response_deserializer=iotics_dot_api_dot_search__pb2.DispatchSearchResponse.FromString,
                _registered_method=True)
        self.SynchronousSearch = channel.unary_stream(
                '/iotics.api.SearchAPI/SynchronousSearch',
                request_serializer=iotics_dot_api_dot_search__pb2.SearchRequest.SerializeToString,
                response_deserializer=iotics_dot_api_dot_search__pb2.SearchResponse.FromString,
                _registered_method=True)
        self.ReceiveAllSearchResponses = channel.unary_stream(
                '/iotics.api.SearchAPI/ReceiveAllSearchResponses',
                request_serializer=iotics_dot_api_dot_common__pb2.SubscriptionHeaders.SerializeToString,
                response_deserializer=iotics_dot_api_dot_search__pb2.SearchResponse.FromString,
                _registered_method=True)
        self.AdvancedSearch = channel.unary_stream(
                '/iotics.api.SearchAPI/AdvancedSearch',
                request_serializer=iotics_dot_api_dot_search__pb2.AdvancedSearchRequest.SerializeToString,
                response_deserializer=iotics_dot_api_dot_search__pb2.SearchResponse.FromString,
                _registered_method=True)


class SearchAPIServicer(object):
    """---------------------------------------------------------------------------------------------------------------------

    SearchAPI provides a set of services to run synchronous and asynchronous search.
    Services only affect local resources, unless stated otherwise.
    """

    def DispatchSearchRequest(self, request, context):
        """Send a search request. Results are expected asynchronously. (local and remote)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SynchronousSearch(self, request, context):
        """Run a synchronous search based on a user timeout. (local and remote)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReceiveAllSearchResponses(self, request, context):
        """Receive all search responses associated to a set of Search request for a given client application ID.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AdvancedSearch(self, request, context):
        """Run an advanced (filter) search request on a user timeout and return formatted results.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SearchAPIServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'DispatchSearchRequest': grpc.unary_unary_rpc_method_handler(
                    servicer.DispatchSearchRequest,
                    request_deserializer=iotics_dot_api_dot_search__pb2.SearchRequest.FromString,
                    response_serializer=iotics_dot_api_dot_search__pb2.DispatchSearchResponse.SerializeToString,
            ),
            'SynchronousSearch': grpc.unary_stream_rpc_method_handler(
                    servicer.SynchronousSearch,
                    request_deserializer=iotics_dot_api_dot_search__pb2.SearchRequest.FromString,
                    response_serializer=iotics_dot_api_dot_search__pb2.SearchResponse.SerializeToString,
            ),
            'ReceiveAllSearchResponses': grpc.unary_stream_rpc_method_handler(
                    servicer.ReceiveAllSearchResponses,
                    request_deserializer=iotics_dot_api_dot_common__pb2.SubscriptionHeaders.FromString,
                    response_serializer=iotics_dot_api_dot_search__pb2.SearchResponse.SerializeToString,
            ),
            'AdvancedSearch': grpc.unary_stream_rpc_method_handler(
                    servicer.AdvancedSearch,
                    request_deserializer=iotics_dot_api_dot_search__pb2.AdvancedSearchRequest.FromString,
                    response_serializer=iotics_dot_api_dot_search__pb2.SearchResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'iotics.api.SearchAPI', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('iotics.api.SearchAPI', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class SearchAPI(object):
    """---------------------------------------------------------------------------------------------------------------------

    SearchAPI provides a set of services to run synchronous and asynchronous search.
    Services only affect local resources, unless stated otherwise.
    """

    @staticmethod
    def DispatchSearchRequest(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,
            '/iotics.api.SearchAPI/DispatchSearchRequest',
            iotics_dot_api_dot_search__pb2.SearchRequest.SerializeToString,
            iotics_dot_api_dot_search__pb2.DispatchSearchResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SynchronousSearch(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,
            '/iotics.api.SearchAPI/SynchronousSearch',
            iotics_dot_api_dot_search__pb2.SearchRequest.SerializeToString,
            iotics_dot_api_dot_search__pb2.SearchResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReceiveAllSearchResponses(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,
            '/iotics.api.SearchAPI/ReceiveAllSearchResponses',
            iotics_dot_api_dot_common__pb2.SubscriptionHeaders.SerializeToString,
            iotics_dot_api_dot_search__pb2.SearchResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def AdvancedSearch(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,
            '/iotics.api.SearchAPI/AdvancedSearch',
            iotics_dot_api_dot_search__pb2.AdvancedSearchRequest.SerializeToString,
            iotics_dot_api_dot_search__pb2.SearchResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
