# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from . import transaction_service_pb2 as com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2


class TransactionServiceStub(object):
  """Allows clients to read transactions from the ledger.
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.GetTransactions = channel.unary_stream(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetTransactions',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionsRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionsResponse.FromString,
        )
    self.GetTransactionTrees = channel.unary_stream(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetTransactionTrees',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionsRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionTreesResponse.FromString,
        )
    self.GetTransactionByEventId = channel.unary_unary(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetTransactionByEventId',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByEventIdRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionResponse.FromString,
        )
    self.GetTransactionById = channel.unary_unary(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetTransactionById',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByIdRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionResponse.FromString,
        )
    self.GetFlatTransactionByEventId = channel.unary_unary(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetFlatTransactionByEventId',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByEventIdRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetFlatTransactionResponse.FromString,
        )
    self.GetFlatTransactionById = channel.unary_unary(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetFlatTransactionById',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByIdRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetFlatTransactionResponse.FromString,
        )
    self.GetLedgerEnd = channel.unary_unary(
        '/com.digitalasset.ledger.api.v1.TransactionService/GetLedgerEnd',
        request_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetLedgerEndRequest.SerializeToString,
        response_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetLedgerEndResponse.FromString,
        )


class TransactionServiceServicer(object):
  """Allows clients to read transactions from the ledger.
  """

  def GetTransactions(self, request, context):
    """Read the ledger's filtered transaction stream for a set of parties.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetTransactionTrees(self, request, context):
    """Read the ledger's complete transaction tree stream for a set of parties.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetTransactionByEventId(self, request, context):
    """Lookup a transaction tree by the ID of an event that appears within it.
    Returns ``NOT_FOUND`` if no such transaction exists.
    For looking up a transaction instead of a transaction tree, please see GetFlatTransactionByEventId
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetTransactionById(self, request, context):
    """Lookup a transaction tree by its ID.
    Returns ``NOT_FOUND`` if no such transaction exists.
    For looking up a transaction instead of a transaction tree, please see GetFlatTransactionById
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetFlatTransactionByEventId(self, request, context):
    """Lookup a transaction by the ID of an event that appears within it.
    Returns ``NOT_FOUND`` if no such transaction exists.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetFlatTransactionById(self, request, context):
    """Lookup a transaction by its ID.
    Returns ``NOT_FOUND`` if no such transaction exists.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetLedgerEnd(self, request, context):
    """Get the current ledger end.
    Subscriptions started with the returned offset will serve transactions created after this RPC was called.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_TransactionServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'GetTransactions': grpc.unary_stream_rpc_method_handler(
          servicer.GetTransactions,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionsRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionsResponse.SerializeToString,
      ),
      'GetTransactionTrees': grpc.unary_stream_rpc_method_handler(
          servicer.GetTransactionTrees,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionsRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionTreesResponse.SerializeToString,
      ),
      'GetTransactionByEventId': grpc.unary_unary_rpc_method_handler(
          servicer.GetTransactionByEventId,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByEventIdRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionResponse.SerializeToString,
      ),
      'GetTransactionById': grpc.unary_unary_rpc_method_handler(
          servicer.GetTransactionById,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByIdRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionResponse.SerializeToString,
      ),
      'GetFlatTransactionByEventId': grpc.unary_unary_rpc_method_handler(
          servicer.GetFlatTransactionByEventId,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByEventIdRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetFlatTransactionResponse.SerializeToString,
      ),
      'GetFlatTransactionById': grpc.unary_unary_rpc_method_handler(
          servicer.GetFlatTransactionById,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetTransactionByIdRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetFlatTransactionResponse.SerializeToString,
      ),
      'GetLedgerEnd': grpc.unary_unary_rpc_method_handler(
          servicer.GetLedgerEnd,
          request_deserializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetLedgerEndRequest.FromString,
          response_serializer=com_dot_digitalasset_dot_ledger_dot_api_dot_v1_dot_transaction__service__pb2.GetLedgerEndResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'com.digitalasset.ledger.api.v1.TransactionService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
