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

io.github.kijuky.zio.jira.JiraUserRepoImpl.scala Maven / Gradle / Ivy

There is a newer version: 1.2.4
Show newest version
package io.github.kijuky.zio.jira

import zio.*

import scala.concurrent.Future

private case class JiraUserRepoImpl(jira: Jira) extends JiraUserRepo {
  override def findByName(name: String): Task[Option[JiraUser]] =
    for {
      user <- ZIO.fromFuture(implicit ec =>
        Future(jira.userClient.getUser(name).get())
      )
    } yield Option(user).map(JiraUser.apply)
}

object JiraUserRepoImpl {
  def layer: URLayer[Jira, JiraUserRepo] =
    ZLayer(
      for jira <- ZIO.service[Jira]
      yield JiraUserRepoImpl(jira)
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy