# 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 meta_pb2 as iotics_dot_api_dot_meta__pb2


class MetaAPIStub(object):
    """---------------------------------------------------------------------------------------------------------------------

    MetaAPI enables querying of metadata associated with Twins and Feeds.
    Services only affect local resources, unless stated otherwise.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.SparqlQuery = channel.unary_stream(
                '/iotics.api.MetaAPI/SparqlQuery',
                request_serializer=iotics_dot_api_dot_meta__pb2.SparqlQueryRequest.SerializeToString,
                response_deserializer=iotics_dot_api_dot_meta__pb2.SparqlQueryResponse.FromString,
                )
        self.SparqlUpdate = channel.unary_unary(
                '/iotics.api.MetaAPI/SparqlUpdate',
                request_serializer=iotics_dot_api_dot_meta__pb2.SparqlUpdateRequest.SerializeToString,
                response_deserializer=iotics_dot_api_dot_meta__pb2.SparqlUpdateResponse.FromString,
                )
        self.ExplorerQuery = channel.unary_stream(
                '/iotics.api.MetaAPI/ExplorerQuery',
                request_serializer=iotics_dot_api_dot_meta__pb2.ExplorerRequest.SerializeToString,
                response_deserializer=iotics_dot_api_dot_meta__pb2.SparqlQueryResponse.FromString,
                )


class MetaAPIServicer(object):
    """---------------------------------------------------------------------------------------------------------------------

    MetaAPI enables querying of metadata associated with Twins and Feeds.
    Services only affect local resources, unless stated otherwise.
    """

    def SparqlQuery(self, request, context):
        """SparqlQuery performs a SPARQL 1.1 query and returns one or more results, each as a sequence of chunks. Note that:
        - Chunks for a particular result will arrive in-order though they might be interleaved with chunks from other
        results (when performing a non-local query). See scope parameter in SparqlQueryRequest;
        - The call will only complete once the (specified or host default) request timeout has been reached. The client can
        choose to end the stream early once they have received enough results. (E.g. in the case of Scope.LOCAL this
        would be after the one and only sequence of chunks has been received.). (local and remote)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SparqlUpdate(self, request, context):
        """SparqlUpdate performs a SPARQL 1.1 update. When performing an update, the update query must contain a reference to
        one of the following graph IRIs:
        1. http://data.iotics.com/graph#custom-public (aka custom public graph) - All metadata written to this graph will be
        visible during SPARQL queries both with local & global scope (and thus, the Iotics network).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ExplorerQuery(self, request, context):
        """ExplorerQuery - Deprecated - use SparqlQuery instead.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MetaAPIServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'SparqlQuery': grpc.unary_stream_rpc_method_handler(
                    servicer.SparqlQuery,
                    request_deserializer=iotics_dot_api_dot_meta__pb2.SparqlQueryRequest.FromString,
                    response_serializer=iotics_dot_api_dot_meta__pb2.SparqlQueryResponse.SerializeToString,
            ),
            'SparqlUpdate': grpc.unary_unary_rpc_method_handler(
                    servicer.SparqlUpdate,
                    request_deserializer=iotics_dot_api_dot_meta__pb2.SparqlUpdateRequest.FromString,
                    response_serializer=iotics_dot_api_dot_meta__pb2.SparqlUpdateResponse.SerializeToString,
            ),
            'ExplorerQuery': grpc.unary_stream_rpc_method_handler(
                    servicer.ExplorerQuery,
                    request_deserializer=iotics_dot_api_dot_meta__pb2.ExplorerRequest.FromString,
                    response_serializer=iotics_dot_api_dot_meta__pb2.SparqlQueryResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'iotics.api.MetaAPI', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


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

    MetaAPI enables querying of metadata associated with Twins and Feeds.
    Services only affect local resources, unless stated otherwise.
    """

    @staticmethod
    def SparqlQuery(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.MetaAPI/SparqlQuery',
            iotics_dot_api_dot_meta__pb2.SparqlQueryRequest.SerializeToString,
            iotics_dot_api_dot_meta__pb2.SparqlQueryResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SparqlUpdate(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.MetaAPI/SparqlUpdate',
            iotics_dot_api_dot_meta__pb2.SparqlUpdateRequest.SerializeToString,
            iotics_dot_api_dot_meta__pb2.SparqlUpdateResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ExplorerQuery(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.MetaAPI/ExplorerQuery',
            iotics_dot_api_dot_meta__pb2.ExplorerRequest.SerializeToString,
            iotics_dot_api_dot_meta__pb2.SparqlQueryResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
