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

from bilireq.grpc.protos.bilibili.broadcast.v1 import broadcast_pb2 as bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class BroadcastStub(object):
    """broadcast操作，对应每个target_path
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Auth = channel.unary_unary(
                '/bilibili.broadcast.v1.Broadcast/Auth',
                request_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.AuthReq.SerializeToString,
                response_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.AuthResp.FromString,
                )
        self.Heartbeat = channel.unary_unary(
                '/bilibili.broadcast.v1.Broadcast/Heartbeat',
                request_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.HeartbeatReq.SerializeToString,
                response_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.HeartbeatResp.FromString,
                )
        self.Subscribe = channel.unary_unary(
                '/bilibili.broadcast.v1.Broadcast/Subscribe',
                request_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.TargetPath.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                )
        self.Unsubscribe = channel.unary_unary(
                '/bilibili.broadcast.v1.Broadcast/Unsubscribe',
                request_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.TargetPath.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                )
        self.MessageAck = channel.unary_unary(
                '/bilibili.broadcast.v1.Broadcast/MessageAck',
                request_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.MessageAckReq.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                )


class BroadcastServicer(object):
    """broadcast操作，对应每个target_path
    """

    def Auth(self, request, context):
        """用户鉴权
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Heartbeat(self, request, context):
        """心跳保活：成功心跳为4分45秒，重试心跳为30s，三次收不到进行重连（不超过5分45）
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Subscribe(self, request, context):
        """订阅target_path
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Unsubscribe(self, request, context):
        """取消订阅target_path
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def MessageAck(self, request, context):
        """消息回执
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_BroadcastServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Auth': grpc.unary_unary_rpc_method_handler(
                    servicer.Auth,
                    request_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.AuthReq.FromString,
                    response_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.AuthResp.SerializeToString,
            ),
            'Heartbeat': grpc.unary_unary_rpc_method_handler(
                    servicer.Heartbeat,
                    request_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.HeartbeatReq.FromString,
                    response_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.HeartbeatResp.SerializeToString,
            ),
            'Subscribe': grpc.unary_unary_rpc_method_handler(
                    servicer.Subscribe,
                    request_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.TargetPath.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'Unsubscribe': grpc.unary_unary_rpc_method_handler(
                    servicer.Unsubscribe,
                    request_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.TargetPath.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'MessageAck': grpc.unary_unary_rpc_method_handler(
                    servicer.MessageAck,
                    request_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.MessageAckReq.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'bilibili.broadcast.v1.Broadcast', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Broadcast(object):
    """broadcast操作，对应每个target_path
    """

    @staticmethod
    def Auth(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, '/bilibili.broadcast.v1.Broadcast/Auth',
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.AuthReq.SerializeToString,
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.AuthResp.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Heartbeat(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, '/bilibili.broadcast.v1.Broadcast/Heartbeat',
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.HeartbeatReq.SerializeToString,
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.HeartbeatResp.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Subscribe(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, '/bilibili.broadcast.v1.Broadcast/Subscribe',
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.TargetPath.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Unsubscribe(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, '/bilibili.broadcast.v1.Broadcast/Unsubscribe',
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.TargetPath.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def MessageAck(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, '/bilibili.broadcast.v1.Broadcast/MessageAck',
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.MessageAckReq.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class BroadcastTunnelStub(object):
    """broadcast连接隧道
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.CreateTunnel = channel.stream_stream(
                '/bilibili.broadcast.v1.BroadcastTunnel/CreateTunnel',
                request_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.BroadcastFrame.SerializeToString,
                response_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.BroadcastFrame.FromString,
                )


class BroadcastTunnelServicer(object):
    """broadcast连接隧道
    """

    def CreateTunnel(self, request_iterator, context):
        """创建双向stream连接隧道
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_BroadcastTunnelServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'CreateTunnel': grpc.stream_stream_rpc_method_handler(
                    servicer.CreateTunnel,
                    request_deserializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.BroadcastFrame.FromString,
                    response_serializer=bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.BroadcastFrame.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'bilibili.broadcast.v1.BroadcastTunnel', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class BroadcastTunnel(object):
    """broadcast连接隧道
    """

    @staticmethod
    def CreateTunnel(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, '/bilibili.broadcast.v1.BroadcastTunnel/CreateTunnel',
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.BroadcastFrame.SerializeToString,
            bilibili_dot_broadcast_dot_v1_dot_broadcast__pb2.BroadcastFrame.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
