package sttp
- Alphabetic
- By Inheritance
- sttp
- SttpApi
- SttpExtensions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- sealed trait BasicRequestBody extends RequestBody[Nothing]
- sealed trait BasicResponseAs[T, +S] extends ResponseAs[T, S]
Response handling specification which isn't derived from another response handling method, but needs to be handled directly by the backend.
- type BodySerializer[B] = (B) => BasicRequestBody
Provide an implicit value of this type to serialize arbitrary classes into a request body.
Provide an implicit value of this type to serialize arbitrary classes into a request body. Backends might also provide special logic for serializer instances which they define (e.g. to handle streaming).
- case class ByteArrayBody(b: Array[Byte], defaultContentType: Option[String] = Some(MediaTypes.Binary)) extends BasicRequestBody with Product with Serializable
- case class ByteBufferBody(b: ByteBuffer, defaultContentType: Option[String] = Some(MediaTypes.Binary)) extends BasicRequestBody with Product with Serializable
- case class Cookie(name: String, value: String, expires: Option[ZonedDateTime] = None, maxAge: Option[Long] = None, domain: Option[String] = None, path: Option[String] = None, secure: Boolean = false, httpOnly: Boolean = false) extends Product with Serializable
- case class DeserializationError[T](original: String, error: T, message: String) extends Product with Serializable
- class EitherBackend[S] extends SttpBackend[[β$0$]Either[Throwable, β$0$], S]
A synchronous backend that safely wraps SttpBackend exceptions in
Either[Throwable, ?]
'sA synchronous backend that safely wraps SttpBackend exceptions in
Either[Throwable, ?]
's- S
The type of streams that are supported by the backend.
Nothing
, if streaming requests/responses is not supported by this backend.
- type Empty[X] = None.type
- case class FileBody(f: SttpFile, defaultContentType: Option[String] = Some(MediaTypes.Binary)) extends BasicRequestBody with Product with Serializable
- class FollowRedirectsBackend[R[_], S] extends SttpBackend[R, S]
- class FutureMonad extends MonadAsyncError[Future]
- trait HeaderNames extends AnyRef
- class HttpURLConnectionBackend extends SttpBackend[Id, Nothing]
- type Id[X] = X
- case class InputStreamBody(b: InputStream, defaultContentType: Option[String] = Some(MediaTypes.Binary)) extends BasicRequestBody with Product with Serializable
- case class MappedResponseAs[T, T2, S](raw: BasicResponseAs[T, S], g: (T, ResponseMetadata) => T2) extends ResponseAs[T2, S] with Product with Serializable
- trait MediaTypes extends AnyRef
- final case class Method(m: String) extends AnyVal with Product with Serializable
- trait MonadAsyncError[R[_]] extends MonadError[R]
- trait MonadError[R[_]] extends AnyRef
- case class Multipart(name: String, body: BasicRequestBody, fileName: Option[String] = None, contentType: Option[String] = None, additionalHeaders: Map[String, String] = Map()) extends Product with Serializable
Use the factory methods
multipart
to conveniently create instances of this class.Use the factory methods
multipart
to conveniently create instances of this class. A part can be then further customised usingfileName
,contentType
andheader
methods. - case class MultipartBody(parts: Seq[Multipart]) extends RequestBody[Nothing] with Product with Serializable
- type PartialRequest[T, +S] = RequestT[Empty, T, S]
- type Request[T, +S] = RequestT[Id, T, S]
- sealed trait RequestBody[+S] extends AnyRef
- case class RequestOptions(followRedirects: Boolean, readTimeout: Duration, maxRedirects: Int, parseResponseIf: (ResponseMetadata) => Boolean, redirectToGet: Boolean) extends Product with Serializable
- case class RequestT[U[_], T, +S](method: U[Method], uri: U[Uri], body: RequestBody[S], headers: Seq[(String, String)], response: ResponseAs[T, S], options: RequestOptions, tags: Map[String, Any]) extends RequestTExtensions[U, T, S] with Product with Serializable
- U
Specifies if the method & uri are specified. By default can be either: *
Empty
, which is a type constructor which always resolves toNone
. This type of request is aliased toPartialRequest
: there's no method and uri specified, and the request cannot be sent. *Id
, which is an identity type constructor. This type of request is aliased toRequest
: the method and uri are specified, and the request can be sent.- response
What's the target type to which the response body should be read. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it. An exception to this are streaming responses, which need to fully consumed by the client if such a response type is requested.
- tags
Request-specific tags which can be used by backends for logging, metrics, etc. Not used by default.
- trait RequestTExtensions[U[_], T, +S] extends AnyRef
- case class Response[T](rawErrorBody: Either[Array[Byte], T], code: StatusCode, statusText: String, headers: Seq[(String, String)], history: List[Response[Unit]]) extends ResponseExtensions[T] with ResponseMetadata with Product with Serializable
- rawErrorBody
Right(T)
, if the request was successful (status code 2xx). The body is then handled as specified in the request.Left(Array[Byte])
, if the request wasn't successful (status code 3xx, 4xx or 5xx).- history
If redirects are followed, and there were redirects, contains responses for the intermediate requests. The first response (oldest) comes first.
- sealed trait ResponseAs[T, +S] extends AnyRef
- T
Target type as which the response will be read.
- S
If
T
is a stream, the type of the stream. Otherwise,Nothing
.
- case class ResponseAsFile(output: SttpFile, overwrite: Boolean) extends BasicResponseAs[SttpFile, Nothing] with Product with Serializable
- case class ResponseAsStream[T, S]()(implicit responseIsStream: =:=[S, T]) extends BasicResponseAs[T, S] with Product with Serializable
- case class ResponseAsString(encoding: String) extends BasicResponseAs[String, Nothing] with Product with Serializable
- trait ResponseExtensions[T] extends AnyRef
- trait ResponseMetadata extends AnyRef
- class SpecifyAuthScheme[U[_], T, +S] extends AnyRef
- type StatusCode = Int
- trait StatusCodes extends AnyRef
- case class StreamBody[S](s: S) extends RequestBody[S] with Product with Serializable
- case class StringBody(s: String, encoding: String, defaultContentType: Option[String] = Some(MediaTypes.Text)) extends BasicRequestBody with Product with Serializable
- trait SttpApi extends SttpExtensions
- implicit class UriContext extends AnyRef
- Definition Classes
- SttpApi
- trait SttpBackend[R[_], -S] extends AnyRef
- R
The type constructor in which responses are wrapped. E.g.
Id
for synchronous backends,Future
for asynchronous backends.- S
The type of streams that are supported by the backend.
Nothing
, if streaming requests/responses is not supported by this backend.
- case class SttpBackendOptions(connectionTimeout: FiniteDuration, proxy: Option[Proxy]) extends Product with Serializable
- trait SttpExtensions extends AnyRef
- class ToCurlConverter[R <: RequestT[Id, _, _]] extends AnyRef
- class TryBackend[S] extends SttpBackend[Try, S]
A synchronous backend that safely wraps SttpBackend exceptions in
Try
'sA synchronous backend that safely wraps SttpBackend exceptions in
Try
's- S
The type of streams that are supported by the backend.
Nothing
, if streaming requests/responses is not supported by this backend.
- case class Uri(scheme: String, userInfo: Option[UserInfo], host: String, port: Option[Int], path: Seq[String], queryFragments: Seq[QueryFragment], fragment: Option[String]) extends Product with Serializable
A URI.
A URI. All components (scheme, host, query, ...) are stored unencoded, and become encoded upon serialization (using toString).
- queryFragments
Either key-value pairs, single values, or plain query fragments. Key value pairs will be serialized as
k=v
, and blocks of key-value pairs/single values will be combined using&
. Note that no&
or other separators are added around plain query fragments - if required, they need to be added manually as part of the plain query fragment.
Value Members
- val DefaultReadTimeout: Duration
- Definition Classes
- SttpApi
- def asByteArray: ResponseAs[Array[Byte], Nothing]
- Definition Classes
- SttpApi
- def asFile(file: File, overwrite: Boolean = false): ResponseAs[File, Nothing]
- Definition Classes
- SttpExtensions
- def asParams(encoding: String): ResponseAs[Seq[(String, String)], Nothing]
Use the given encoding by default, unless specified otherwise in the response headers.
Use the given encoding by default, unless specified otherwise in the response headers.
- Definition Classes
- SttpApi
- def asParams: ResponseAs[Seq[(String, String)], Nothing]
Use the
utf-8
encoding by default, unless specified otherwise in the response headers.Use the
utf-8
encoding by default, unless specified otherwise in the response headers.- Definition Classes
- SttpApi
- def asPath(path: Path, overwrite: Boolean = false): ResponseAs[Path, Nothing]
- Definition Classes
- SttpExtensions
- def asStream[S]: ResponseAs[S, S]
- Definition Classes
- SttpApi
- def asString(encoding: String): ResponseAs[String, Nothing]
Use the given encoding by default, unless specified otherwise in the response headers.
Use the given encoding by default, unless specified otherwise in the response headers.
- Definition Classes
- SttpApi
- def asString: ResponseAs[String, Nothing]
Use the
utf-8
encoding by default, unless specified otherwise in the response headers.Use the
utf-8
encoding by default, unless specified otherwise in the response headers.- Definition Classes
- SttpApi
- val emptyRequest: RequestT[Empty, String, Nothing]
An empty request with no headers.
An empty request with no headers.
- Definition Classes
- SttpApi
- def ignore: ResponseAs[Unit, Nothing]
- Definition Classes
- SttpApi
- def multipart[B](name: String, b: B)(implicit arg0: BodySerializer[B]): Multipart
Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, fs: Seq[(String, String)], encoding: String): Multipart
Encodes the given parameters as form data.
Encodes the given parameters as form data.
Content type will be set to
application/x-www-form-urlencoded
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, fs: Seq[(String, String)]): Multipart
Encodes the given parameters as form data using
utf-8
.Encodes the given parameters as form data using
utf-8
.Content type will be set to
application/x-www-form-urlencoded
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, fs: Map[String, String], encoding: String): Multipart
Encodes the given parameters as form data.
Encodes the given parameters as form data.
Content type will be set to
application/x-www-form-urlencoded
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, fs: Map[String, String]): Multipart
Encodes the given parameters as form data using
utf-8
.Encodes the given parameters as form data using
utf-8
.Content type will be set to
application/x-www-form-urlencoded
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, data: InputStream): Multipart
Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, data: ByteBuffer): Multipart
Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, data: Array[Byte]): Multipart
Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, data: String, encoding: String): Multipart
Content type will be set to
text/plain
withutf-8
encoding, can be overridden later using thecontentType
method.Content type will be set to
text/plain
withutf-8
encoding, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipart(name: String, data: String): Multipart
Content type will be set to
text/plain
withutf-8
encoding, can be overridden later using thecontentType
method.Content type will be set to
text/plain
withutf-8
encoding, can be overridden later using thecontentType
method.- Definition Classes
- SttpApi
- def multipartFile(name: String, data: Path): Multipart
Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.File name will be set to the name of the file.
- Definition Classes
- SttpExtensions
- def multipartFile(name: String, data: File): Multipart
Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.Content type will be set to
application/octet-stream
, can be overridden later using thecontentType
method.File name will be set to the name of the file.
- Definition Classes
- SttpExtensions
- val sttp: RequestT[Empty, String, Nothing]
A starting request, with the following modifications comparing to
emptyRequest
:A starting request, with the following modifications comparing to
emptyRequest
:-
Accept-Encoding
set togzip, deflate
(handled automatically by the library)- Definition Classes
- SttpApi
- object Cookie extends Serializable
- object EitherMonad extends MonadError[[β$0$]Either[Throwable, β$0$]]
- object FileHelpers
- object FollowRedirectsBackend
- object HeaderNames extends HeaderNames
- object HttpURLConnectionBackend
- object IdMonad extends MonadError[Id]
- object IgnoreResponse extends BasicResponseAs[Unit, Nothing] with Product with Serializable
- object MediaTypes extends MediaTypes
- object Method extends Serializable
- object NoBody extends RequestBody[Nothing] with Product with Serializable
- object RequestBody
- object Response extends Serializable
- object ResponseAs
- object ResponseAsByteArray extends BasicResponseAs[Array[Byte], Nothing] with Product with Serializable
- object ResponseMetadata
- object Rfc3986
- object Rfc3986Compatibility
- object StatusCodes extends StatusCodes
- object SttpBackendOptions extends Serializable
- object ToCurlConverter
- object TryHttpURLConnectionBackend
- object TryMonad extends MonadError[Try]
- object Uri extends Serializable
- object UriInterpolator
- object monadSyntax
- object quick extends SttpApi