Skip to content

Commit

Permalink
refactor: TriplestoreServiceLive: use Sttp with ZIO instead of Apache…
Browse files Browse the repository at this point in the history
… HTTP (DEV-1627) (#3251)
  • Loading branch information
siers authored May 28, 2024
1 parent 7f7c0b6 commit 0488add
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package org.knora.webapi.slice.admin.domain.service

import sttp.capabilities.zio.ZioStreams
import sttp.client3.Empty
import sttp.client3.RequestT
import sttp.client3.SttpBackend
import sttp.client3.UriContext
import sttp.client3.asStreamAlways
Expand Down Expand Up @@ -70,10 +72,11 @@ final case class DspIngestClientLive(

private def projectsPath(shortcode: Shortcode) = s"${dspIngestConfig.baseUrl}/projects/${shortcode.value}"

private val authenticatedRequest = jwtService
.createJwtForDspIngest()
.map(_.jwtString)
.map(basicRequest.auth.bearer(_))
private val authenticatedRequest: ZIO[Any, Nothing, RequestT[Empty, Either[String, String], Any]] =
jwtService
.createJwtForDspIngest()
.map(_.jwtString)
.map(basicRequest.auth.bearer(_))

override def getAssetInfo(shortcode: Shortcode, assetId: AssetId): Task[AssetInfoResponse] =
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ trait FusekiTriplestore {
}

case class FusekiPaths(config: Fuseki) {
val checkServer = "/$/server"
val repository = s"/${config.repositoryName}"
val data = s"$repository/data"
val get = s"$repository/get"
val query = s"$repository/query"
val update = s"$repository/update"
val datasets = "/$/datasets"
val checkServer: List[String] = List("$", "server")
val repository: List[String] = List(config.repositoryName)
val data: List[String] = repository :+ "data"
val get: List[String] = repository :+ "get"
val query: List[String] = repository :+ "query"
val update: List[String] = repository :+ "update"
val datasets: List[String] = List("$", "datasets")
}
Loading

0 comments on commit 0488add

Please sign in to comment.