# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from capsule8.api.v0 import pubsub_service_pb2 as capsule8_dot_api_dot_v0_dot_pubsub__service__pb2


class PubsubServiceStub(object):
  """
  Capsule8 Pubsub API

  The Pubsub API is used by capsulators to publish and subscribe to typed
  messages
  for well defined topic names. Arbitrary types can be sent over non well
  defined topics.

  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.Publish = channel.unary_unary(
        '/capsule8.api.v0.PubsubService/Publish',
        request_serializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PublishRequest.SerializeToString,
        response_deserializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PublishResponse.FromString,
        )
    self.Pull = channel.unary_stream(
        '/capsule8.api.v0.PubsubService/Pull',
        request_serializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PullRequest.SerializeToString,
        response_deserializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PullResponse.FromString,
        )
    self.Acknowledge = channel.unary_unary(
        '/capsule8.api.v0.PubsubService/Acknowledge',
        request_serializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.AcknowledgeRequest.SerializeToString,
        response_deserializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.AcknowledgeResponse.FromString,
        )


class PubsubServiceServicer(object):
  """
  Capsule8 Pubsub API

  The Pubsub API is used by capsulators to publish and subscribe to typed
  messages
  for well defined topic names. Arbitrary types can be sent over non well
  defined topics.

  """

  def Publish(self, request, context):
    """Publishes messages to a topic
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Pull(self, request, context):
    """Pulls messages off of a topic
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Acknowledge(self, request, context):
    # missing associated documentation comment in .proto file
    pass
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_PubsubServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Publish': grpc.unary_unary_rpc_method_handler(
          servicer.Publish,
          request_deserializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PublishRequest.FromString,
          response_serializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PublishResponse.SerializeToString,
      ),
      'Pull': grpc.unary_stream_rpc_method_handler(
          servicer.Pull,
          request_deserializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PullRequest.FromString,
          response_serializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.PullResponse.SerializeToString,
      ),
      'Acknowledge': grpc.unary_unary_rpc_method_handler(
          servicer.Acknowledge,
          request_deserializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.AcknowledgeRequest.FromString,
          response_serializer=capsule8_dot_api_dot_v0_dot_pubsub__service__pb2.AcknowledgeResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'capsule8.api.v0.PubsubService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
