diff options
author | adamw <adam@warski.org> | 2017-10-12 19:23:09 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-10-12 19:23:09 +0200 |
commit | 7bf4d02da823c21b27cf20ba0b764b511ac69432 (patch) | |
tree | 04b9ab557c4af82b9970af386e6f4f9e4292e472 /docs/requests/type.rst | |
parent | 7885188a982c193e26f8ca6bc9aea8f6a642b32d (diff) | |
download | sttp-7bf4d02da823c21b27cf20ba0b764b511ac69432.tar.gz sttp-7bf4d02da823c21b27cf20ba0b764b511ac69432.tar.bz2 sttp-7bf4d02da823c21b27cf20ba0b764b511ac69432.zip |
More docs
Diffstat (limited to 'docs/requests/type.rst')
-rw-r--r-- | docs/requests/type.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/requests/type.rst b/docs/requests/type.rst new file mode 100644 index 0000000..3cefe97 --- /dev/null +++ b/docs/requests/type.rst @@ -0,0 +1,17 @@ +Request type +============ + +All request descriptions have type ``RequestT[U, T, S]`` (T as in Template). +If this looks a bit complex, don't worry, what the three type parameters stand +for is the only thing you'll hopefully have to remember when using the API! + +Going one-by-one: + +* ``U[_]`` specifies if the request method and URL are specified. Using the API, this can be either ``type Empty[X] = None``, meaning that the request has neither a method nor an URI. Or, it can be ``type Id[X] = X`` (type-level identity), meaning that the request has both a method and an URI specified. Only requests with a specified URI & method can be sent. +* ``T`` specifies the type to which the response will be read. By default, this is ``String``. But it can also be e.g. ``Array[Byte]`` or ``Unit``, if the response should be ignored. Response body handling can be changed by calling the ``.response`` method. With backends which support streaming, this can also be a supported stream type. +* ``S`` specifies the stream type that this request uses. Most of the time this will be ``Nothing``, meaning that this request does not send a streaming body or receive a streaming response. So most of the times you can just ignore that parameter. But, if you are using a streaming backend and want to send/receive a stream, the ``.streamBody`` or ``response(asStream[S])`` will change the type parameter. + +There are two type aliases for the request template that are used: + +* ``type Request[T, S] = RequestT[Id, T, S]``. A sendable request. +* ``type PartialRequest[T, S] = RequestT[Empty, T, S]`` |