Skip to content

Commit

Permalink
Release 3.3.0-RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Apr 8, 2021
1 parent c6a6b09 commit 430328f
Show file tree
Hide file tree
Showing 25 changed files with 200 additions and 187 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ sttp (v2) documentation is available at [sttp.softwaremill.com/en/v2](http://stt

sttp (v1) documentation is available at [sttp.softwaremill.com/en/v1](https://sttp.softwaremill.com/en/v1).

scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client3/core_2.12/3.2.3)
scaladoc is available at [https://www.javadoc.io](https://www.javadoc.io/doc/com.softwaremill.sttp.client3/core_2.12/3.3.0-RC1)

## Quickstart with Ammonite

If you are an [Ammonite](http://ammonite.io) user, you can quickly start experimenting with sttp by copy-pasting the following:

```scala
import $ivy.`com.softwaremill.sttp.client3::core:3.2.3`
import $ivy.`com.softwaremill.sttp.client3::core:3.3.0-RC1`
import sttp.client3.quick._
quickRequest.get(uri"http://httpbin.org/ip").send(backend)
```
Expand All @@ -64,7 +64,7 @@ This brings in the sttp API and a synchronous backend instance.
Add the following dependency:

```scala
"com.softwaremill.sttp.client3" %% "core" % "3.2.3"
"com.softwaremill.sttp.client3" %% "core" % "3.3.0-RC1"
```

Then, import:
Expand Down Expand Up @@ -98,7 +98,7 @@ The documentation is typechecked using [mdoc](https://scalameta.org/mdoc/). The

When generating documentation, it's best to set the version to the current one, so that the generated doc files don't include modifications with the current snapshot version.

That is, in sbt run: `set version := "3.2.3"`, before running `mdoc` in `docs`.
That is, in sbt run: `set version := "3.3.0-RC1"`, before running `mdoc` in `docs`.

### Testing the Scala.JS backend

Expand Down
2 changes: 1 addition & 1 deletion generated-docs/out/adr/0001-extract-stream-from-http4s.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This way of consuming streams is less safe, but that's a design decision of sttp
to adjust the way http4s works and "extract" the stream from http4s, releasing the connection only when the
stream is fully read (or completes with an error).

To do that, in `Http4sBackend`, we create two `MVar`s: one to signal that the request body has been fully
To do that, in `Http4sBackend`, we create two `Deferred`s: one to signal that the request body has been fully
consumed (`responseBodyCompleteVar`), and another, `responseVar`, to extract the response.

When the request is read, first the stream body is adjusted, so that the completion var is filled in the stream's
Expand Down
4 changes: 2 additions & 2 deletions generated-docs/out/backends/akka.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
This backend is based on [akka-http](http://doc.akka.io/docs/akka-http/current/scala/http/). To use, add the following dependency to your project:

```
"com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.2.3"
"com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.3.0-RC1"
```

A fully **asynchronous** backend. Uses the `Future` effect to return responses. There are also [other `Future`-based backends](future.md), which don't depend on Akka.

Note that you'll also need an explicit dependency on akka-streams, as akka-http doesn't depend on any specific akka-streams version. So you'll also need to add, for example:

```
"com.typesafe.akka" %% "akka-stream" % "2.6.13"
"com.typesafe.akka" %% "akka-stream" % "2.6.14"
```

Next you'll need to add create the backend instance:
Expand Down
56 changes: 30 additions & 26 deletions generated-docs/out/backends/catseffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,14 @@ The [Cats Effect](https://github.com/typelevel/cats-effect) backend is **asynchr
To use, add the following dependency to your project:

```scala
"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % "3.2.3"
```

You'll need the following imports and implicits to create the backend:

```scala
import sttp.client3._
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend
import cats.effect._

// an implicit `cats.effect.ContextShift` in required to create the backend; here, for `cats.effect.IO`:
implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global)
"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % "3.3.0-RC1" // for cats-effect 3.x
// or
"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats-ce2" % "3.3.0-RC1" // for cats-effect 2.x
```
This backend depends on [async-http-client](https://github.com/AsyncHttpClient/async-http-client), uses [Netty](http://netty.io) behind the scenes.

Alternatively, the [http4s](http4s.md) backend can also be created for a type implementing the cats-effect's `Effect` typeclass, and supports streaming as in [fs2](fs2.md).
Alternatively, the [http4s](http4s.md) backend can also be created for a type implementing the cats-effect's `Async` typeclass, and supports streaming as in [fs2](fs2.md).

Next you'll need to define a backend instance. This can be done in two basic ways:

Expand All @@ -33,39 +24,53 @@ Next you'll need to define a backend instance. This can be done in two basic way
A non-comprehensive summary of how the backend can be created is as follows:

```scala
import cats.effect.IO
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend

// the type class instance needs to be provided explicitly (e.g. `cats.effect.IO`).
// the effect type must implement the Concurrent typeclass
// the effect type must implement the Async typeclass
AsyncHttpClientCatsBackend[IO]().flatMap { backend => ??? }
```

or, if you'd like to use a custom configuration:

```scala
import cats.effect.IO
import org.asynchttpclient.AsyncHttpClientConfig
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend

val config: AsyncHttpClientConfig = ???
AsyncHttpClientCatsBackend.usingConfig[IO](config).flatMap { backend => ??? }
```

or, if you'd like to use adjust the configuration sttp creates:

```scala
import cats.effect.IO
import org.asynchttpclient.DefaultAsyncHttpClientConfig
import sttp.client3.SttpBackendOptions
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend

val sttpOptions: SttpBackendOptions = SttpBackendOptions.Default
val adjustFunction: DefaultAsyncHttpClientConfig.Builder => DefaultAsyncHttpClientConfig.Builder = ???
AsyncHttpClientCatsBackend.usingConfigBuilder[IO](adjustFunction, sttpOptions).flatMap { backend => ??? }
```

or, if you'd like the backend to be wrapped in cats-effect Resource:
or, if you'd like the backend to be wrapped in cats-effect `Resource`:

```scala
import cats.effect.IO
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend

AsyncHttpClientCatsBackend.resource[IO]().use { backend => ??? }
```

or, if you'd like to instantiate the AsyncHttpClient yourself:
or, if you'd like to instantiate the `AsyncHttpClient` yourself:

```scala
import cats.effect.IO
import org.asynchttpclient.AsyncHttpClient
import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend

val asyncHttpClient: AsyncHttpClient = ???
val backend = AsyncHttpClientCatsBackend.usingClient[IO](asyncHttpClient)
Expand All @@ -75,29 +80,28 @@ val backend = AsyncHttpClientCatsBackend.usingClient[IO](asyncHttpClient)

To use, add the following dependency to your project:

```
"com.softwaremill.sttp.client3" %% "armeria-backend-cats" % "3.2.3"
```

add imports:

```scala
import sttp.client3.armeria.cats.ArmeriaCatsBackend
import cats.effect.{ContextShift, IO}
"com.softwaremill.sttp.client3" %% "armeria-backend-cats" % "3.3.0-RC1" // for cats-effect 3.x
// or
"com.softwaremill.sttp.client3" %% "armeria-backend-cats-ce2" % "3.3.0-RC1" // for cats-effect 2.x
```

create client:

```scala
implicit val cs: ContextShift[IO] = IO.contextShift(scala.concurrent.ExecutionContext.global)
import cats.effect.IO
import sttp.client3.armeria.cats.ArmeriaCatsBackend

val backend = ArmeriaCatsBackend[IO]()
```

or, if you'd like to instantiate the [WebClient](https://armeria.dev/docs/client-http) yourself:

```scala
import com.linecorp.armeria.client.circuitbreaker._
import cats.effect.IO
import com.linecorp.armeria.client.WebClient
import com.linecorp.armeria.client.circuitbreaker._
import sttp.client3.armeria.cats.ArmeriaCatsBackend

// Fluently build Armeria WebClient with built-in decorators
val client = WebClient.builder("https://my-service.com")
Expand Down
2 changes: 1 addition & 1 deletion generated-docs/out/backends/finagle.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To use, add the following dependency to your project:

```
"com.softwaremill.sttp.client3" %% "finagle-backend" % "3.2.3"
"com.softwaremill.sttp.client3" %% "finagle-backend" % "3.3.0-RC1"
```

Next you'll need to add an implicit value:
Expand Down
Loading

0 comments on commit 430328f

Please sign in to comment.