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

com.kodekutters.taxii.Status.scala Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
package com.kodekutters.taxii

import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global


/**
  * This Endpoint provides information about the status of a previous request.
  *
  * @param conn the connection to the com.kodekutters.taxii server
  */
case class Status(api_root: String, status_id: String, conn: TaxiiConnection) {

  val thePath = api_root + "/status/" + status_id + "/"

  // request the Status resource from the server --> will get the resource or an error message.
  lazy val response: Future[Either[TaxiiErrorMessage, TaxiiStatus]] = conn.fetch[TaxiiStatus](thePath)
  // extract the Status resource from the response
  lazy val taxiiStatus: Future[Option[TaxiiStatus]] = response.map(_.toOption)
  // extract the error message from the response
  lazy val errorMessage: Future[Option[TaxiiErrorMessage]] = response.map(Left(_).toOption)

  def get(): Future[Option[TaxiiStatus]] = taxiiStatus

}







© 2015 - 2024 Weber Informatics LLC | Privacy Policy