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

smithy4s.kinesis4cats.kcl.http4s.generated.KCLService.scala Maven / Gradle / Ivy

There is a newer version: 0.0.32
Show newest version
package kinesis4cats.kcl.http4s.generated

import smithy4s.Endpoint
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.Service
import smithy4s.ShapeId
import smithy4s.Transformation
import smithy4s.kinds.PolyFunction5
import smithy4s.kinds.toPolyFunction5.const5
import smithy4s.schema.ErrorSchema
import smithy4s.schema.OperationSchema
import smithy4s.schema.Schema.bijection
import smithy4s.schema.Schema.union
import smithy4s.schema.Schema.unit

trait KCLServiceGen[F[_, _, _, _, _]] {
  self =>

  def initialized(): F[Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing]
  def healthcheck(): F[Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing]

  def transform: Transformation.PartiallyApplied[KCLServiceGen[F]] = Transformation.of[KCLServiceGen[F]](this)
}

object KCLServiceGen extends Service.Mixin[KCLServiceGen, KCLServiceOperation] {

  val id: ShapeId = ShapeId("kinesis4cats.kcl.http4s.generated", "KCLService")
  val version: String = "1.0.0"

  val hints: Hints = Hints(
    alloy.SimpleRestJson(),
  ).lazily

  def apply[F[_]](implicit F: Impl[F]): F.type = F

  object ErrorAware {
    def apply[F[_, _]](implicit F: ErrorAware[F]): F.type = F
    type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
  }

  val endpoints: Vector[smithy4s.Endpoint[KCLServiceOperation, ?, ?, ?, ?, ?]] = Vector(
    KCLServiceOperation.Initialized,
    KCLServiceOperation.Healthcheck,
  )

  def input[I, E, O, SI, SO](op: KCLServiceOperation[I, E, O, SI, SO]): I = op.input
  def ordinal[I, E, O, SI, SO](op: KCLServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
  override def endpoint[I, E, O, SI, SO](op: KCLServiceOperation[I, E, O, SI, SO]) = op.endpoint
  class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends KCLServiceOperation.Transformed[KCLServiceOperation, P](reified, const5(value))
  type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
  def reified: KCLServiceGen[KCLServiceOperation] = KCLServiceOperation.reified
  def mapK5[P[_, _, _, _, _], P1[_, _, _, _, _]](alg: KCLServiceGen[P], f: PolyFunction5[P, P1]): KCLServiceGen[P1] = new KCLServiceOperation.Transformed(alg, f)
  def fromPolyFunction[P[_, _, _, _, _]](f: PolyFunction5[KCLServiceOperation, P]): KCLServiceGen[P] = new KCLServiceOperation.Transformed(reified, f)
  def toPolyFunction[P[_, _, _, _, _]](impl: KCLServiceGen[P]): PolyFunction5[KCLServiceOperation, P] = KCLServiceOperation.toPolyFunction(impl)

  type InitializedError = KCLServiceOperation.InitializedError
  val InitializedError = KCLServiceOperation.InitializedError
  type HealthcheckError = KCLServiceOperation.HealthcheckError
  val HealthcheckError = KCLServiceOperation.HealthcheckError
}

sealed trait KCLServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
  def run[F[_, _, _, _, _]](impl: KCLServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
  def ordinal: Int
  def input: Input
  def endpoint: Endpoint[KCLServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}

object KCLServiceOperation {

  object reified extends KCLServiceGen[KCLServiceOperation] {
    def initialized(): Initialized = Initialized()
    def healthcheck(): Healthcheck = Healthcheck()
  }
  class Transformed[P[_, _, _, _, _], P1[_ ,_ ,_ ,_ ,_]](alg: KCLServiceGen[P], f: PolyFunction5[P, P1]) extends KCLServiceGen[P1] {
    def initialized(): P1[Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing] = f[Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing](alg.initialized())
    def healthcheck(): P1[Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing] = f[Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing](alg.healthcheck())
  }

  def toPolyFunction[P[_, _, _, _, _]](impl: KCLServiceGen[P]): PolyFunction5[KCLServiceOperation, P] = new PolyFunction5[KCLServiceOperation, P] {
    def apply[I, E, O, SI, SO](op: KCLServiceOperation[I, E, O, SI, SO]): P[I, E, O, SI, SO] = op.run(impl) 
  }
  final case class Initialized() extends KCLServiceOperation[Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing] {
    def run[F[_, _, _, _, _]](impl: KCLServiceGen[F]): F[Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing] = impl.initialized()
    def ordinal: Int = 0
    def input: Unit = ()
    def endpoint: smithy4s.Endpoint[KCLServiceOperation,Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing] = Initialized
  }
  object Initialized extends smithy4s.Endpoint[KCLServiceOperation,Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing] {
    val schema: OperationSchema[Unit, KCLServiceOperation.InitializedError, Response, Nothing, Nothing] = Schema.operation(ShapeId("kinesis4cats.kcl.http4s.generated", "Initialized"))
      .withInput(unit)
      .withError(InitializedError.errorSchema)
      .withOutput(Response.schema)
      .withHints(smithy.api.Http(method = smithy.api.NonEmptyString("GET"), uri = smithy.api.NonEmptyString("/initialized"), code = 200), smithy.api.Readonly())
    def wrap(input: Unit): Initialized = Initialized()
  }
  sealed trait InitializedError extends scala.Product with scala.Serializable { self =>
    @inline final def widen: InitializedError = this
    def $ordinal: Int

    object project {
      def serviceNotReadyError: Option[ServiceNotReadyError] = InitializedError.ServiceNotReadyErrorCase.alt.project.lift(self).map(_.serviceNotReadyError)
    }

    def accept[A](visitor: InitializedError.Visitor[A]): A = this match {
      case value: InitializedError.ServiceNotReadyErrorCase => visitor.serviceNotReadyError(value.serviceNotReadyError)
    }
  }
  object InitializedError extends ErrorSchema.Companion[InitializedError] {

    def serviceNotReadyError(serviceNotReadyError: ServiceNotReadyError): InitializedError = ServiceNotReadyErrorCase(serviceNotReadyError)

    val id: ShapeId = ShapeId("kinesis4cats.kcl.http4s.generated", "InitializedError")

    val hints: Hints = Hints.empty

    final case class ServiceNotReadyErrorCase(serviceNotReadyError: ServiceNotReadyError) extends InitializedError { final def $ordinal: Int = 0 }

    object ServiceNotReadyErrorCase {
      val hints: Hints = Hints.empty
      val schema: Schema[InitializedError.ServiceNotReadyErrorCase] = bijection(ServiceNotReadyError.schema.addHints(hints), InitializedError.ServiceNotReadyErrorCase(_), _.serviceNotReadyError)
      val alt = schema.oneOf[InitializedError]("ServiceNotReadyError")
    }

    trait Visitor[A] {
      def serviceNotReadyError(value: ServiceNotReadyError): A
    }

    object Visitor {
      trait Default[A] extends Visitor[A] {
        def default: A
        def serviceNotReadyError(value: ServiceNotReadyError): A = default
      }
    }

    implicit val schema: Schema[InitializedError] = union(
      InitializedError.ServiceNotReadyErrorCase.alt,
    ){
      _.$ordinal
    }
    def liftError(throwable: Throwable): Option[InitializedError] = throwable match {
      case e: ServiceNotReadyError => Some(InitializedError.ServiceNotReadyErrorCase(e))
      case _ => None
    }
    def unliftError(e: InitializedError): Throwable = e match {
      case InitializedError.ServiceNotReadyErrorCase(e) => e
    }
  }
  final case class Healthcheck() extends KCLServiceOperation[Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing] {
    def run[F[_, _, _, _, _]](impl: KCLServiceGen[F]): F[Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing] = impl.healthcheck()
    def ordinal: Int = 1
    def input: Unit = ()
    def endpoint: smithy4s.Endpoint[KCLServiceOperation,Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing] = Healthcheck
  }
  object Healthcheck extends smithy4s.Endpoint[KCLServiceOperation,Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing] {
    val schema: OperationSchema[Unit, KCLServiceOperation.HealthcheckError, Response, Nothing, Nothing] = Schema.operation(ShapeId("kinesis4cats.kcl.http4s.generated", "Healthcheck"))
      .withInput(unit)
      .withError(HealthcheckError.errorSchema)
      .withOutput(Response.schema)
      .withHints(smithy.api.Http(method = smithy.api.NonEmptyString("GET"), uri = smithy.api.NonEmptyString("/healthcheck"), code = 200), smithy.api.Readonly())
    def wrap(input: Unit): Healthcheck = Healthcheck()
  }
  sealed trait HealthcheckError extends scala.Product with scala.Serializable { self =>
    @inline final def widen: HealthcheckError = this
    def $ordinal: Int

    object project {
      def serviceNotReadyError: Option[ServiceNotReadyError] = HealthcheckError.ServiceNotReadyErrorCase.alt.project.lift(self).map(_.serviceNotReadyError)
    }

    def accept[A](visitor: HealthcheckError.Visitor[A]): A = this match {
      case value: HealthcheckError.ServiceNotReadyErrorCase => visitor.serviceNotReadyError(value.serviceNotReadyError)
    }
  }
  object HealthcheckError extends ErrorSchema.Companion[HealthcheckError] {

    def serviceNotReadyError(serviceNotReadyError: ServiceNotReadyError): HealthcheckError = ServiceNotReadyErrorCase(serviceNotReadyError)

    val id: ShapeId = ShapeId("kinesis4cats.kcl.http4s.generated", "HealthcheckError")

    val hints: Hints = Hints.empty

    final case class ServiceNotReadyErrorCase(serviceNotReadyError: ServiceNotReadyError) extends HealthcheckError { final def $ordinal: Int = 0 }

    object ServiceNotReadyErrorCase {
      val hints: Hints = Hints.empty
      val schema: Schema[HealthcheckError.ServiceNotReadyErrorCase] = bijection(ServiceNotReadyError.schema.addHints(hints), HealthcheckError.ServiceNotReadyErrorCase(_), _.serviceNotReadyError)
      val alt = schema.oneOf[HealthcheckError]("ServiceNotReadyError")
    }

    trait Visitor[A] {
      def serviceNotReadyError(value: ServiceNotReadyError): A
    }

    object Visitor {
      trait Default[A] extends Visitor[A] {
        def default: A
        def serviceNotReadyError(value: ServiceNotReadyError): A = default
      }
    }

    implicit val schema: Schema[HealthcheckError] = union(
      HealthcheckError.ServiceNotReadyErrorCase.alt,
    ){
      _.$ordinal
    }
    def liftError(throwable: Throwable): Option[HealthcheckError] = throwable match {
      case e: ServiceNotReadyError => Some(HealthcheckError.ServiceNotReadyErrorCase(e))
      case _ => None
    }
    def unliftError(e: HealthcheckError): Throwable = e match {
      case HealthcheckError.ServiceNotReadyErrorCase(e) => e
    }
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy