# 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,
                _registered_method=True)
        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,
                _registered_method=True)


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 against the Federated Knowledge Graph of the Iotics network to which this
        host belongs. The result is returned as a sequence of chunks. Note that:
        - Result chunks MIGHT arrive out of order and it is the client's responsibility to re-assemble them.
        - This RPC is currently in beta, it means:
        - the logic should remain unchanged,
        - the rpc call should remain unchanged,
        - the service can be interrupted without notice.
        """
        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 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,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'iotics.api.MetaAPI', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('iotics.api.MetaAPI', rpc_method_handlers)


 # 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,
            _registered_method=True)

    @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,
            _registered_method=True)
