lnrpc.RPCMiddlewareRequest.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 requestId
*
* The unique ID of the intercepted original gRPC request. Useful for mapping
* request to response when implementing full duplex message interception. For
* streaming requests, this will be the same ID for all incoming and outgoing
* middleware intercept messages of the _same_ stream.
* @param rawMacaroon
*
* The raw bytes of the complete macaroon as sent by the gRPC client in the
* original request. This might be empty for a request that doesn't require
* macaroons such as the wallet unlocker RPCs.
* @param customCaveatCondition
*
* The parsed condition of the macaroon's custom caveat for convenient access.
* This field only contains the value of the custom caveat that the handling
* middleware has registered itself for. The condition _must_ be validated for
* messages of intercept_type stream_auth and request!
* @param msgId
*
* The unique message ID of this middleware intercept message. There can be
* multiple middleware intercept messages per single gRPC request (one for the
* incoming request and one for the outgoing response) or gRPC stream (one for
* each incoming message and one for each outgoing response). This message ID
* must be referenced when responding (accepting/rejecting/modifying) to an
* intercept message.
*/
@SerialVersionUID(0L)
final case class RPCMiddlewareRequest(
requestId: org.bitcoins.core.number.UInt64 = lnrpc.RPCMiddlewareRequest._typemapper_requestId.toCustom(0L),
rawMacaroon: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
customCaveatCondition: _root_.scala.Predef.String = "",
interceptType: lnrpc.RPCMiddlewareRequest.InterceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Empty,
msgId: org.bitcoins.core.number.UInt64 = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toCustom(0L),
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[RPCMiddlewareRequest] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
{
val __value = lnrpc.RPCMiddlewareRequest._typemapper_requestId.toBase(requestId)
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
}
};
{
val __value = rawMacaroon
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value)
}
};
{
val __value = customCaveatCondition
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
}
};
if (interceptType.streamAuth.isDefined) {
val __value = interceptType.streamAuth.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (interceptType.request.isDefined) {
val __value = interceptType.request.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (interceptType.response.isDefined) {
val __value = interceptType.response.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (interceptType.regComplete.isDefined) {
val __value = interceptType.regComplete.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(8, __value)
};
{
val __value = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toBase(msgId)
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(7, __value)
}
};
__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.RPCMiddlewareRequest._typemapper_requestId.toBase(requestId)
if (__v != 0L) {
_output__.writeUInt64(1, __v)
}
};
{
val __v = rawMacaroon
if (!__v.isEmpty) {
_output__.writeBytes(2, __v)
}
};
{
val __v = customCaveatCondition
if (!__v.isEmpty) {
_output__.writeString(3, __v)
}
};
interceptType.streamAuth.foreach { __v =>
val __m = __v
_output__.writeTag(4, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
interceptType.request.foreach { __v =>
val __m = __v
_output__.writeTag(5, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
interceptType.response.foreach { __v =>
val __m = __v
_output__.writeTag(6, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toBase(msgId)
if (__v != 0L) {
_output__.writeUInt64(7, __v)
}
};
interceptType.regComplete.foreach { __v =>
val __m = __v
_output__.writeBool(8, __m)
};
unknownFields.writeTo(_output__)
}
def withRequestId(__v: org.bitcoins.core.number.UInt64): RPCMiddlewareRequest = copy(requestId = __v)
def withRawMacaroon(__v: _root_.com.google.protobuf.ByteString): RPCMiddlewareRequest = copy(rawMacaroon = __v)
def withCustomCaveatCondition(__v: _root_.scala.Predef.String): RPCMiddlewareRequest = copy(customCaveatCondition = __v)
def getStreamAuth: lnrpc.StreamAuth = interceptType.streamAuth.getOrElse(lnrpc.StreamAuth.defaultInstance)
def withStreamAuth(__v: lnrpc.StreamAuth): RPCMiddlewareRequest = copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.StreamAuth(__v))
def getRequest: lnrpc.RPCMessage = interceptType.request.getOrElse(lnrpc.RPCMessage.defaultInstance)
def withRequest(__v: lnrpc.RPCMessage): RPCMiddlewareRequest = copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Request(__v))
def getResponse: lnrpc.RPCMessage = interceptType.response.getOrElse(lnrpc.RPCMessage.defaultInstance)
def withResponse(__v: lnrpc.RPCMessage): RPCMiddlewareRequest = copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Response(__v))
def getRegComplete: _root_.scala.Boolean = interceptType.regComplete.getOrElse(false)
def withRegComplete(__v: _root_.scala.Boolean): RPCMiddlewareRequest = copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.RegComplete(__v))
def withMsgId(__v: org.bitcoins.core.number.UInt64): RPCMiddlewareRequest = copy(msgId = __v)
def clearInterceptType: RPCMiddlewareRequest = copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Empty)
def withInterceptType(__v: lnrpc.RPCMiddlewareRequest.InterceptType): RPCMiddlewareRequest = copy(interceptType = __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.RPCMiddlewareRequest._typemapper_requestId.toBase(requestId)
if (__t != 0L) __t else null
}
case 2 => {
val __t = rawMacaroon
if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
}
case 3 => {
val __t = customCaveatCondition
if (__t != "") __t else null
}
case 4 => interceptType.streamAuth.orNull
case 5 => interceptType.request.orNull
case 6 => interceptType.response.orNull
case 8 => interceptType.regComplete.orNull
case 7 => {
val __t = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toBase(msgId)
if (__t != 0L) __t else null
}
}
}
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.RPCMiddlewareRequest._typemapper_requestId.toBase(requestId))
case 2 => _root_.scalapb.descriptors.PByteString(rawMacaroon)
case 3 => _root_.scalapb.descriptors.PString(customCaveatCondition)
case 4 => interceptType.streamAuth.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 5 => interceptType.request.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 6 => interceptType.response.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 8 => interceptType.regComplete.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 7 => _root_.scalapb.descriptors.PLong(lnrpc.RPCMiddlewareRequest._typemapper_msgId.toBase(msgId))
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: lnrpc.RPCMiddlewareRequest.type = lnrpc.RPCMiddlewareRequest
// @@protoc_insertion_point(GeneratedMessage[lnrpc.RPCMiddlewareRequest])
}
object RPCMiddlewareRequest extends scalapb.GeneratedMessageCompanion[lnrpc.RPCMiddlewareRequest] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.RPCMiddlewareRequest] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.RPCMiddlewareRequest = {
var __requestId: _root_.scala.Long = 0L
var __rawMacaroon: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
var __customCaveatCondition: _root_.scala.Predef.String = ""
var __msgId: _root_.scala.Long = 0L
var __interceptType: lnrpc.RPCMiddlewareRequest.InterceptType = lnrpc.RPCMiddlewareRequest.InterceptType.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 =>
__requestId = _input__.readUInt64()
case 18 =>
__rawMacaroon = _input__.readBytes()
case 26 =>
__customCaveatCondition = _input__.readStringRequireUtf8()
case 34 =>
__interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.StreamAuth(__interceptType.streamAuth.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.StreamAuth](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 42 =>
__interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Request(__interceptType.request.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.RPCMessage](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 50 =>
__interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Response(__interceptType.response.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.RPCMessage](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 64 =>
__interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.RegComplete(_input__.readBool())
case 56 =>
__msgId = _input__.readUInt64()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
lnrpc.RPCMiddlewareRequest(
requestId = lnrpc.RPCMiddlewareRequest._typemapper_requestId.toCustom(__requestId),
rawMacaroon = __rawMacaroon,
customCaveatCondition = __customCaveatCondition,
msgId = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toCustom(__msgId),
interceptType = __interceptType,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.RPCMiddlewareRequest] = _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.RPCMiddlewareRequest(
requestId = lnrpc.RPCMiddlewareRequest._typemapper_requestId.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
rawMacaroon = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
customCaveatCondition = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
msgId = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
interceptType = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[lnrpc.StreamAuth]]).map(lnrpc.RPCMiddlewareRequest.InterceptType.StreamAuth(_))
.orElse[lnrpc.RPCMiddlewareRequest.InterceptType](__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[lnrpc.RPCMessage]]).map(lnrpc.RPCMiddlewareRequest.InterceptType.Request(_)))
.orElse[lnrpc.RPCMiddlewareRequest.InterceptType](__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[lnrpc.RPCMessage]]).map(lnrpc.RPCMiddlewareRequest.InterceptType.Response(_)))
.orElse[lnrpc.RPCMiddlewareRequest.InterceptType](__fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]).map(lnrpc.RPCMiddlewareRequest.InterceptType.RegComplete(_)))
.getOrElse(lnrpc.RPCMiddlewareRequest.InterceptType.Empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(186)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(186)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 4 => __out = lnrpc.StreamAuth
case 5 => __out = lnrpc.RPCMessage
case 6 => __out = lnrpc.RPCMessage
}
__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.RPCMiddlewareRequest(
requestId = lnrpc.RPCMiddlewareRequest._typemapper_requestId.toCustom(0L),
rawMacaroon = _root_.com.google.protobuf.ByteString.EMPTY,
customCaveatCondition = "",
msgId = lnrpc.RPCMiddlewareRequest._typemapper_msgId.toCustom(0L),
interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Empty
)
sealed trait InterceptType extends _root_.scalapb.GeneratedOneof {
def isEmpty: _root_.scala.Boolean = false
def isDefined: _root_.scala.Boolean = true
def isStreamAuth: _root_.scala.Boolean = false
def isRequest: _root_.scala.Boolean = false
def isResponse: _root_.scala.Boolean = false
def isRegComplete: _root_.scala.Boolean = false
def streamAuth: _root_.scala.Option[lnrpc.StreamAuth] = _root_.scala.None
def request: _root_.scala.Option[lnrpc.RPCMessage] = _root_.scala.None
def response: _root_.scala.Option[lnrpc.RPCMessage] = _root_.scala.None
def regComplete: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None
}
object InterceptType {
@SerialVersionUID(0L)
case object Empty extends lnrpc.RPCMiddlewareRequest.InterceptType {
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 StreamAuth(value: lnrpc.StreamAuth) extends lnrpc.RPCMiddlewareRequest.InterceptType {
type ValueType = lnrpc.StreamAuth
override def isStreamAuth: _root_.scala.Boolean = true
override def streamAuth: _root_.scala.Option[lnrpc.StreamAuth] = Some(value)
override def number: _root_.scala.Int = 4
}
@SerialVersionUID(0L)
final case class Request(value: lnrpc.RPCMessage) extends lnrpc.RPCMiddlewareRequest.InterceptType {
type ValueType = lnrpc.RPCMessage
override def isRequest: _root_.scala.Boolean = true
override def request: _root_.scala.Option[lnrpc.RPCMessage] = Some(value)
override def number: _root_.scala.Int = 5
}
@SerialVersionUID(0L)
final case class Response(value: lnrpc.RPCMessage) extends lnrpc.RPCMiddlewareRequest.InterceptType {
type ValueType = lnrpc.RPCMessage
override def isResponse: _root_.scala.Boolean = true
override def response: _root_.scala.Option[lnrpc.RPCMessage] = Some(value)
override def number: _root_.scala.Int = 6
}
@SerialVersionUID(0L)
final case class RegComplete(value: _root_.scala.Boolean) extends lnrpc.RPCMiddlewareRequest.InterceptType {
type ValueType = _root_.scala.Boolean
override def isRegComplete: _root_.scala.Boolean = true
override def regComplete: _root_.scala.Option[_root_.scala.Boolean] = Some(value)
override def number: _root_.scala.Int = 8
}
}
implicit class RPCMiddlewareRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RPCMiddlewareRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.RPCMiddlewareRequest](_l) {
def requestId: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.requestId)((c_, f_) => c_.copy(requestId = f_))
def rawMacaroon: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.rawMacaroon)((c_, f_) => c_.copy(rawMacaroon = f_))
def customCaveatCondition: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.customCaveatCondition)((c_, f_) => c_.copy(customCaveatCondition = f_))
def streamAuth: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.StreamAuth] = field(_.getStreamAuth)((c_, f_) => c_.copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.StreamAuth(f_)))
def request: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RPCMessage] = field(_.getRequest)((c_, f_) => c_.copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Request(f_)))
def response: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RPCMessage] = field(_.getResponse)((c_, f_) => c_.copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.Response(f_)))
def regComplete: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getRegComplete)((c_, f_) => c_.copy(interceptType = lnrpc.RPCMiddlewareRequest.InterceptType.RegComplete(f_)))
def msgId: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.msgId)((c_, f_) => c_.copy(msgId = f_))
def interceptType: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RPCMiddlewareRequest.InterceptType] = field(_.interceptType)((c_, f_) => c_.copy(interceptType = f_))
}
final val REQUEST_ID_FIELD_NUMBER = 1
final val RAW_MACAROON_FIELD_NUMBER = 2
final val CUSTOM_CAVEAT_CONDITION_FIELD_NUMBER = 3
final val STREAM_AUTH_FIELD_NUMBER = 4
final val REQUEST_FIELD_NUMBER = 5
final val RESPONSE_FIELD_NUMBER = 6
final val REG_COMPLETE_FIELD_NUMBER = 8
final val MSG_ID_FIELD_NUMBER = 7
@transient
private[lnrpc] val _typemapper_requestId: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
@transient
private[lnrpc] val _typemapper_msgId: _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(
requestId: org.bitcoins.core.number.UInt64,
rawMacaroon: _root_.com.google.protobuf.ByteString,
customCaveatCondition: _root_.scala.Predef.String,
interceptType: lnrpc.RPCMiddlewareRequest.InterceptType,
msgId: org.bitcoins.core.number.UInt64
): _root_.lnrpc.RPCMiddlewareRequest = _root_.lnrpc.RPCMiddlewareRequest(
requestId,
rawMacaroon,
customCaveatCondition,
interceptType,
msgId
)
// @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.RPCMiddlewareRequest])
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy