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

import mekadb_client_pb2 as mekadb__client__pb2


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

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

        Args:
            channel: A grpc.Channel.
        """
        self.authenticate = channel.unary_unary(
                '/mekadb_client.MekaDBClient/authenticate',
                request_serializer=mekadb__client__pb2.AuthReq.SerializeToString,
                response_deserializer=mekadb__client__pb2.AuthCtx.FromString,
                )
        self.SqlWithJsonResponse = channel.stream_stream(
                '/mekadb_client.MekaDBClient/SqlWithJsonResponse',
                request_serializer=mekadb__client__pb2.SqlRequest.SerializeToString,
                response_deserializer=mekadb__client__pb2.SqlResponse.FromString,
                )


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

    def authenticate(self, request, context):
        """Log into a database to obtain an authentication context that can be used to execute SQL queries
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SqlWithJsonResponse(self, request_iterator, context):
        """Executes the SQL query given and returns a JSON array response as a string.
        The JSON array contains objects where each key is the name of the column, lowercased.
        For example a table with the columns username, Age and CITY will return
        [{"username":"Courtney","age":1,"city":"San Francisco"}]
        i.e. the column names are lower cased, the values are the original as inserted into the table
        If there are no results, the string returned will always be "[]"
        i.e. you can always parse the string and assume there is a JSON array but it can be an empty array
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MekaDBClientServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'authenticate': grpc.unary_unary_rpc_method_handler(
                    servicer.authenticate,
                    request_deserializer=mekadb__client__pb2.AuthReq.FromString,
                    response_serializer=mekadb__client__pb2.AuthCtx.SerializeToString,
            ),
            'SqlWithJsonResponse': grpc.stream_stream_rpc_method_handler(
                    servicer.SqlWithJsonResponse,
                    request_deserializer=mekadb__client__pb2.SqlRequest.FromString,
                    response_serializer=mekadb__client__pb2.SqlResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mekadb_client.MekaDBClient', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


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

    @staticmethod
    def authenticate(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, '/mekadb_client.MekaDBClient/authenticate',
            mekadb__client__pb2.AuthReq.SerializeToString,
            mekadb__client__pb2.AuthCtx.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SqlWithJsonResponse(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, '/mekadb_client.MekaDBClient/SqlWithJsonResponse',
            mekadb__client__pb2.SqlRequest.SerializeToString,
            mekadb__client__pb2.SqlResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
