All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lnrpc.RPCMiddlewareResponse.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package lnrpc
import org.bitcoins.lnd.rpc.LndUtils._

/** @param refMsgId
  *  
  *  The request message ID this response refers to. Must always be set when
  *  giving feedback to an intercept but is ignored for the initial registration
  *  message.
  */
@SerialVersionUID(0L)
final case class RPCMiddlewareResponse(
    refMsgId: org.bitcoins.core.number.UInt64 = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toCustom(0L),
    middlewareMessage: lnrpc.RPCMiddlewareResponse.MiddlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RPCMiddlewareResponse] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toBase(refMsgId)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
        }
      };
      if (middlewareMessage.register.isDefined) {
        val __value = middlewareMessage.register.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (middlewareMessage.feedback.isDefined) {
        val __value = middlewareMessage.feedback.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      {
        val __v = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toBase(refMsgId)
        if (__v != 0L) {
          _output__.writeUInt64(1, __v)
        }
      };
      middlewareMessage.register.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      middlewareMessage.feedback.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withRefMsgId(__v: org.bitcoins.core.number.UInt64): RPCMiddlewareResponse = copy(refMsgId = __v)
    def getRegister: lnrpc.MiddlewareRegistration = middlewareMessage.register.getOrElse(lnrpc.MiddlewareRegistration.defaultInstance)
    def withRegister(__v: lnrpc.MiddlewareRegistration): RPCMiddlewareResponse = copy(middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Register(__v))
    def getFeedback: lnrpc.InterceptFeedback = middlewareMessage.feedback.getOrElse(lnrpc.InterceptFeedback.defaultInstance)
    def withFeedback(__v: lnrpc.InterceptFeedback): RPCMiddlewareResponse = copy(middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Feedback(__v))
    def clearMiddlewareMessage: RPCMiddlewareResponse = copy(middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Empty)
    def withMiddlewareMessage(__v: lnrpc.RPCMiddlewareResponse.MiddlewareMessage): RPCMiddlewareResponse = copy(middlewareMessage = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => {
          val __t = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toBase(refMsgId)
          if (__t != 0L) __t else null
        }
        case 2 => middlewareMessage.register.orNull
        case 3 => middlewareMessage.feedback.orNull
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PLong(lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toBase(refMsgId))
        case 2 => middlewareMessage.register.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => middlewareMessage.feedback.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.RPCMiddlewareResponse.type = lnrpc.RPCMiddlewareResponse
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.RPCMiddlewareResponse])
}

object RPCMiddlewareResponse extends scalapb.GeneratedMessageCompanion[lnrpc.RPCMiddlewareResponse] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.RPCMiddlewareResponse] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.RPCMiddlewareResponse = {
    var __refMsgId: _root_.scala.Long = 0L
    var __middlewareMessage: lnrpc.RPCMiddlewareResponse.MiddlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __refMsgId = _input__.readUInt64()
        case 18 =>
          __middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Register(__middlewareMessage.register.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.MiddlewareRegistration](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Feedback(__middlewareMessage.feedback.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.InterceptFeedback](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.RPCMiddlewareResponse(
        refMsgId = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toCustom(__refMsgId),
        middlewareMessage = __middlewareMessage,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.RPCMiddlewareResponse] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      lnrpc.RPCMiddlewareResponse(
        refMsgId = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        middlewareMessage = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[lnrpc.MiddlewareRegistration]]).map(lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Register(_))
            .orElse[lnrpc.RPCMiddlewareResponse.MiddlewareMessage](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[lnrpc.InterceptFeedback]]).map(lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Feedback(_)))
            .getOrElse(lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(189)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(189)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = lnrpc.MiddlewareRegistration
      case 3 => __out = lnrpc.InterceptFeedback
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = lnrpc.RPCMiddlewareResponse(
    refMsgId = lnrpc.RPCMiddlewareResponse._typemapper_refMsgId.toCustom(0L),
    middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Empty
  )
  sealed trait MiddlewareMessage extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isRegister: _root_.scala.Boolean = false
    def isFeedback: _root_.scala.Boolean = false
    def register: _root_.scala.Option[lnrpc.MiddlewareRegistration] = _root_.scala.None
    def feedback: _root_.scala.Option[lnrpc.InterceptFeedback] = _root_.scala.None
  }
  object MiddlewareMessage {
    @SerialVersionUID(0L)
    case object Empty extends lnrpc.RPCMiddlewareResponse.MiddlewareMessage {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class Register(value: lnrpc.MiddlewareRegistration) extends lnrpc.RPCMiddlewareResponse.MiddlewareMessage {
      type ValueType = lnrpc.MiddlewareRegistration
      override def isRegister: _root_.scala.Boolean = true
      override def register: _root_.scala.Option[lnrpc.MiddlewareRegistration] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class Feedback(value: lnrpc.InterceptFeedback) extends lnrpc.RPCMiddlewareResponse.MiddlewareMessage {
      type ValueType = lnrpc.InterceptFeedback
      override def isFeedback: _root_.scala.Boolean = true
      override def feedback: _root_.scala.Option[lnrpc.InterceptFeedback] = Some(value)
      override def number: _root_.scala.Int = 3
    }
  }
  implicit class RPCMiddlewareResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RPCMiddlewareResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.RPCMiddlewareResponse](_l) {
    def refMsgId: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.refMsgId)((c_, f_) => c_.copy(refMsgId = f_))
    def register: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.MiddlewareRegistration] = field(_.getRegister)((c_, f_) => c_.copy(middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Register(f_)))
    def feedback: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.InterceptFeedback] = field(_.getFeedback)((c_, f_) => c_.copy(middlewareMessage = lnrpc.RPCMiddlewareResponse.MiddlewareMessage.Feedback(f_)))
    def middlewareMessage: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RPCMiddlewareResponse.MiddlewareMessage] = field(_.middlewareMessage)((c_, f_) => c_.copy(middlewareMessage = f_))
  }
  final val REF_MSG_ID_FIELD_NUMBER = 1
  final val REGISTER_FIELD_NUMBER = 2
  final val FEEDBACK_FIELD_NUMBER = 3
  @transient
  private[lnrpc] val _typemapper_refMsgId: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
  def of(
    refMsgId: org.bitcoins.core.number.UInt64,
    middlewareMessage: lnrpc.RPCMiddlewareResponse.MiddlewareMessage
  ): _root_.lnrpc.RPCMiddlewareResponse = _root_.lnrpc.RPCMiddlewareResponse(
    refMsgId,
    middlewareMessage
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.RPCMiddlewareResponse])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy