OkClient

com.malliina.http.OkClient
See theOkClient companion object
class OkClient(val client: OkHttpClient, ec: ExecutionContext) extends HttpClient[Future] with OkHttpBackend

Attributes

Companion:
object
Graph
Supertypes
trait HttpClient[Future]
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Inherited classlikes

implicit class FOps[T](f: F[T])

Attributes

Inherited from:
HttpClient
Graph
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def execute(request: Request): Future[OkHttpResponse]
override def fail[T](e: Exception): Future[T]

Attributes

Definition Classes
override def flatMap[T, U](t: Future[T])(f: T => Future[U]): Future[U]

Attributes

Definition Classes
def raw(request: Request): Future[Response]

Remember to close the response body if calling this method. If you don't need to stream the response, call execute instead.

Remember to close the response body if calling this method. If you don't need to stream the response, call execute instead.

Attributes

request

request to execute

Returns:

the response

def streamed[T](request: Request)(consume: Response => Future[T]): Future[T]

Provides the response but closes the response body after consume completes.

Provides the response but closes the response body after consume completes.

Attributes

T

type of result

consume

code to consume the response

request

request

override def success[T](t: T): Future[T]

Attributes

Definition Classes

Inherited methods

override def close(): Unit

Attributes

Definition Classes
OkHttpBackend -> Closeable -> AutoCloseable
Inherited from:
OkHttpBackend
def download(url: FullUrl, to: Path, headers: Map[String, String]): F[Either[StatusError, StorageSize]]

Downloads url to to, returning the number of bytes written to to.

Downloads url to to, returning the number of bytes written to to.

Attributes

headers

http headers

to

destination, a file

url

url to download

Returns:

bytes written

Inherited from:
HttpClient
def get(url: FullUrl, headers: Map[String, String]): F[OkHttpResponse]

Attributes

Inherited from:
HttpClient
def getAs[T : Decoder](url: FullUrl, headers: Map[String, String]): F[T]

Attributes

Inherited from:
HttpClient
def multiPart(url: FullUrl, headers: Map[String, String], parts: Map[String, String], files: Seq[MultiPartFile]): F[OkHttpResponse]

Attributes

Inherited from:
HttpClient
def parse[T : Decoder](response: OkHttpResponse, url: FullUrl): F[T]

Parses the response as a T.

Parses the response as a T.

The returned Future fails with a ResponseError if parsing fails.

Attributes

T

type to parse

response

HTTP response

url

the request URL

Returns:

a parsed response

Inherited from:
HttpClient
def post(url: FullUrl, body: RequestBody, headers: Map[String, String]): F[OkHttpResponse]

Attributes

Inherited from:
HttpClient
def postAs[W : Encoder, T : Decoder](url: FullUrl, json: W, headers: Map[String, String]): F[T]

Attributes

Inherited from:
HttpClient
def postFile(url: FullUrl, mediaType: MediaType, file: Path, headers: Map[String, String]): F[OkHttpResponse]

Attributes

Inherited from:
HttpClient
def postForm(url: FullUrl, form: Map[String, String], headers: Map[String, String]): F[OkHttpResponse]

Attributes

Inherited from:
HttpClient
def postFormAs[T : Decoder](url: FullUrl, form: Map[String, String], headers: Map[String, String]): F[T]

Attributes

Inherited from:
HttpClient
def postJson(url: FullUrl, json: Json, headers: Map[String, String]): F[OkHttpResponse]

Attributes

Inherited from:
HttpClient
def postJsonAs[T : Decoder](url: FullUrl, json: Json, headers: Map[String, String]): F[T]

Attributes

Inherited from:
HttpClient

Concrete fields

val client: OkHttpClient

Implicits

Implicits

implicit val exec: ExecutionContext

Inherited implicits

final implicit def FOps[T](f: Future[T]): FOps[T]

Attributes

Inherited from:
HttpClient