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

from ..browser import BrowserPerf_pb2 as browser_dot_BrowserPerf__pb2
from ..common import Common_pb2 as common_dot_Common__pb2


class BrowserPerfServiceStub(object):
    """Collect performance raw data from browser.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.collectPerfData = channel.unary_unary(
                '/BrowserPerfService/collectPerfData',
                request_serializer=browser_dot_BrowserPerf__pb2.BrowserPerfData.SerializeToString,
                response_deserializer=common_dot_Common__pb2.Commands.FromString,
                )
        self.collectErrorLogs = channel.stream_unary(
                '/BrowserPerfService/collectErrorLogs',
                request_serializer=browser_dot_BrowserPerf__pb2.BrowserErrorLog.SerializeToString,
                response_deserializer=common_dot_Common__pb2.Commands.FromString,
                )


class BrowserPerfServiceServicer(object):
    """Collect performance raw data from browser.
    """

    def collectPerfData(self, request, context):
        """report once per page
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def collectErrorLogs(self, request_iterator, context):
        """report one or more error logs for pages, could report multiple times.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_BrowserPerfServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'collectPerfData': grpc.unary_unary_rpc_method_handler(
                    servicer.collectPerfData,
                    request_deserializer=browser_dot_BrowserPerf__pb2.BrowserPerfData.FromString,
                    response_serializer=common_dot_Common__pb2.Commands.SerializeToString,
            ),
            'collectErrorLogs': grpc.stream_unary_rpc_method_handler(
                    servicer.collectErrorLogs,
                    request_deserializer=browser_dot_BrowserPerf__pb2.BrowserErrorLog.FromString,
                    response_serializer=common_dot_Common__pb2.Commands.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'BrowserPerfService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class BrowserPerfService(object):
    """Collect performance raw data from browser.
    """

    @staticmethod
    def collectPerfData(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, '/BrowserPerfService/collectPerfData',
            browser_dot_BrowserPerf__pb2.BrowserPerfData.SerializeToString,
            common_dot_Common__pb2.Commands.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def collectErrorLogs(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_unary(request_iterator, target, '/BrowserPerfService/collectErrorLogs',
            browser_dot_BrowserPerf__pb2.BrowserErrorLog.SerializeToString,
            common_dot_Common__pb2.Commands.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
