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

zio.aws.managedblockchainquery.model.TransactionOutputItem.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.managedblockchainquery.model
import zio.aws.managedblockchainquery.model.primitives.{
  Timestamp,
  QueryTransactionId,
  QueryTransactionHash
}
import java.time.Instant
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import scala.jdk.CollectionConverters.*
final case class TransactionOutputItem(
    transactionHash: QueryTransactionHash,
    transactionId: Optional[QueryTransactionId] = Optional.Absent,
    network: zio.aws.managedblockchainquery.model.QueryNetwork,
    transactionTimestamp: Timestamp,
    confirmationStatus: Optional[
      zio.aws.managedblockchainquery.model.ConfirmationStatus
    ] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.managedblockchainquery.model.TransactionOutputItem = {
    import TransactionOutputItem.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.managedblockchainquery.model.TransactionOutputItem
      .builder()
      .transactionHash(
        QueryTransactionHash.unwrap(transactionHash): java.lang.String
      )
      .optionallyWith(
        transactionId.map(value =>
          QueryTransactionId.unwrap(value): java.lang.String
        )
      )(_.transactionId)
      .network(network.unwrap)
      .transactionTimestamp(Timestamp.unwrap(transactionTimestamp): Instant)
      .optionallyWith(confirmationStatus.map(value => value.unwrap))(
        _.confirmationStatus
      )
      .build()
  }
  def asReadOnly
      : zio.aws.managedblockchainquery.model.TransactionOutputItem.ReadOnly =
    zio.aws.managedblockchainquery.model.TransactionOutputItem
      .wrap(buildAwsValue())
}
object TransactionOutputItem {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.managedblockchainquery.model.TransactionOutputItem
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.managedblockchainquery.model.TransactionOutputItem =
      zio.aws.managedblockchainquery.model.TransactionOutputItem(
        transactionHash,
        transactionId.map(value => value),
        network,
        transactionTimestamp,
        confirmationStatus.map(value => value)
      )
    def transactionHash: QueryTransactionHash
    def transactionId: Optional[QueryTransactionId]
    def network: zio.aws.managedblockchainquery.model.QueryNetwork
    def transactionTimestamp: Timestamp
    def confirmationStatus
        : Optional[zio.aws.managedblockchainquery.model.ConfirmationStatus]
    def getTransactionHash: ZIO[Any, Nothing, QueryTransactionHash] =
      ZIO.succeed(transactionHash)
    def getTransactionId: ZIO[Any, AwsError, QueryTransactionId] =
      AwsError.unwrapOptionField("transactionId", transactionId)
    def getNetwork
        : ZIO[Any, Nothing, zio.aws.managedblockchainquery.model.QueryNetwork] =
      ZIO.succeed(network)
    def getTransactionTimestamp: ZIO[Any, Nothing, Timestamp] =
      ZIO.succeed(transactionTimestamp)
    def getConfirmationStatus: ZIO[
      Any,
      AwsError,
      zio.aws.managedblockchainquery.model.ConfirmationStatus
    ] = AwsError.unwrapOptionField("confirmationStatus", confirmationStatus)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.managedblockchainquery.model.TransactionOutputItem
  ) extends zio.aws.managedblockchainquery.model.TransactionOutputItem.ReadOnly {
    override val transactionHash: QueryTransactionHash =
      zio.aws.managedblockchainquery.model.primitives
        .QueryTransactionHash(impl.transactionHash())
    override val transactionId: Optional[QueryTransactionId] =
      zio.aws.core.internal
        .optionalFromNullable(impl.transactionId())
        .map(value =>
          zio.aws.managedblockchainquery.model.primitives
            .QueryTransactionId(value)
        )
    override val network: zio.aws.managedblockchainquery.model.QueryNetwork =
      zio.aws.managedblockchainquery.model.QueryNetwork.wrap(impl.network())
    override val transactionTimestamp: Timestamp =
      zio.aws.managedblockchainquery.model.primitives
        .Timestamp(impl.transactionTimestamp())
    override val confirmationStatus
        : Optional[zio.aws.managedblockchainquery.model.ConfirmationStatus] =
      zio.aws.core.internal
        .optionalFromNullable(impl.confirmationStatus())
        .map(value =>
          zio.aws.managedblockchainquery.model.ConfirmationStatus.wrap(value)
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.managedblockchainquery.model.TransactionOutputItem
  ): zio.aws.managedblockchainquery.model.TransactionOutputItem.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy