def restoreToExisting()

in app/logic/FlexibleApi.scala [30:43]


  def restoreToExisting(stack: FlexibleStack, userHeader: (String, String), contentId: String, snapshot: Snapshot): Attempt[String] = {
    val attempt = Attempt.Async.Right(
      wsClient
        .url(s"${stack.apiPrefix}/restorer/content/$contentId")
        .withHttpHeaders(userHeader)
        .put(snapshot.data)
    )
    attempt.flatMap { response =>
      response.status match {
        case 204 => Attempt.Right(s"${stack.composerPrefix}/content/$contentId")
        case other => Attempt.Left(AttemptError(s"Failed to restore to existing: $other - ${response.body}"))
      }
    }
  }