lnrpc.ConnectPeerRequest.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 addr
*
* Lightning address of the peer to connect to.
* @param perm
*
* If set, the daemon will attempt to persistently connect to the target
* peer. Otherwise, the call will be synchronous.
* @param timeout
*
* The connection timeout value (in seconds) for this request. It won't affect
* other requests.
*/
@SerialVersionUID(0L)
final case class ConnectPeerRequest(
addr: _root_.scala.Option[lnrpc.LightningAddress] = _root_.scala.None,
perm: _root_.scala.Boolean = false,
timeout: org.bitcoins.core.number.UInt64 = lnrpc.ConnectPeerRequest._typemapper_timeout.toCustom(0L),
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ConnectPeerRequest] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (addr.isDefined) {
val __value = addr.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
{
val __value = perm
if (__value != false) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(2, __value)
}
};
{
val __value = lnrpc.ConnectPeerRequest._typemapper_timeout.toBase(timeout)
if (__value != 0L) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(3, __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 = {
addr.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = perm
if (__v != false) {
_output__.writeBool(2, __v)
}
};
{
val __v = lnrpc.ConnectPeerRequest._typemapper_timeout.toBase(timeout)
if (__v != 0L) {
_output__.writeUInt64(3, __v)
}
};
unknownFields.writeTo(_output__)
}
def getAddr: lnrpc.LightningAddress = addr.getOrElse(lnrpc.LightningAddress.defaultInstance)
def clearAddr: ConnectPeerRequest = copy(addr = _root_.scala.None)
def withAddr(__v: lnrpc.LightningAddress): ConnectPeerRequest = copy(addr = Option(__v))
def withPerm(__v: _root_.scala.Boolean): ConnectPeerRequest = copy(perm = __v)
def withTimeout(__v: org.bitcoins.core.number.UInt64): ConnectPeerRequest = copy(timeout = __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 => addr.orNull
case 2 => {
val __t = perm
if (__t != false) __t else null
}
case 3 => {
val __t = lnrpc.ConnectPeerRequest._typemapper_timeout.toBase(timeout)
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 => addr.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => _root_.scalapb.descriptors.PBoolean(perm)
case 3 => _root_.scalapb.descriptors.PLong(lnrpc.ConnectPeerRequest._typemapper_timeout.toBase(timeout))
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: lnrpc.ConnectPeerRequest.type = lnrpc.ConnectPeerRequest
// @@protoc_insertion_point(GeneratedMessage[lnrpc.ConnectPeerRequest])
}
object ConnectPeerRequest extends scalapb.GeneratedMessageCompanion[lnrpc.ConnectPeerRequest] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.ConnectPeerRequest] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.ConnectPeerRequest = {
var __addr: _root_.scala.Option[lnrpc.LightningAddress] = _root_.scala.None
var __perm: _root_.scala.Boolean = false
var __timeout: _root_.scala.Long = 0L
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__addr = Option(__addr.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.LightningAddress](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 16 =>
__perm = _input__.readBool()
case 24 =>
__timeout = _input__.readUInt64()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
lnrpc.ConnectPeerRequest(
addr = __addr,
perm = __perm,
timeout = lnrpc.ConnectPeerRequest._typemapper_timeout.toCustom(__timeout),
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.ConnectPeerRequest] = _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.ConnectPeerRequest(
addr = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[lnrpc.LightningAddress]]),
perm = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
timeout = lnrpc.ConnectPeerRequest._typemapper_timeout.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Long]).getOrElse(0L))
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(35)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(35)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = lnrpc.LightningAddress
}
__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.ConnectPeerRequest(
addr = _root_.scala.None,
perm = false,
timeout = lnrpc.ConnectPeerRequest._typemapper_timeout.toCustom(0L)
)
implicit class ConnectPeerRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.ConnectPeerRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.ConnectPeerRequest](_l) {
def addr: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.LightningAddress] = field(_.getAddr)((c_, f_) => c_.copy(addr = Option(f_)))
def optionalAddr: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.LightningAddress]] = field(_.addr)((c_, f_) => c_.copy(addr = f_))
def perm: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.perm)((c_, f_) => c_.copy(perm = f_))
def timeout: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.timeout)((c_, f_) => c_.copy(timeout = f_))
}
final val ADDR_FIELD_NUMBER = 1
final val PERM_FIELD_NUMBER = 2
final val TIMEOUT_FIELD_NUMBER = 3
@transient
private[lnrpc] val _typemapper_timeout: _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(
addr: _root_.scala.Option[lnrpc.LightningAddress],
perm: _root_.scala.Boolean,
timeout: org.bitcoins.core.number.UInt64
): _root_.lnrpc.ConnectPeerRequest = _root_.lnrpc.ConnectPeerRequest(
addr,
perm,
timeout
)
// @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.ConnectPeerRequest])
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy