diff --git a/retrofit-adapters/guava/README.md b/retrofit-adapters/guava/README.md index 171ba8a5ed3ba46e64fce96324874cfe5e0dd7d0..b1449e80e79c618bb562ba24f5f4040593c63ebe 100644 --- a/retrofit-adapters/guava/README.md +++ b/retrofit-adapters/guava/README.md @@ -4,6 +4,26 @@ Guava Adapter An `Adapter` for adapting [Guava][1] `ListenableFuture`. +Usage +----- + +Add `GuavaCallAdapterFactory` as a `Call` adapter when building your `Retrofit` instance: +```java +Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://example.com/") + .addCallAdapterFactory(GuavaCallAdapterFactory.create()) + .build(); +``` + +Your service methods can now use `ListenableFuture` as their return type. +```java +interface MyService { + @GET("/user") + ListenableFuture getUser(); +} +``` + + Download -------- diff --git a/retrofit-adapters/java8/README.md b/retrofit-adapters/java8/README.md index 1280b727b2e9eb1d22050ae5e24ec2c569a6b34b..83424c809a86041f752c7f425bc3673df46bb1b2 100644 --- a/retrofit-adapters/java8/README.md +++ b/retrofit-adapters/java8/README.md @@ -4,6 +4,26 @@ Java8 Adapter An `Adapter` for adapting [Java8][1] `CompletableFuture`. +Usage +----- + +Add `Java8CallAdapterFactory` as a `Call` adapter when building your `Retrofit` instance: +```java +Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://example.com/") + .addCallAdapterFactory(Java8CallAdapterFactory.create()) + .build(); +``` + +Your service methods can now use `CompletableFuture` as their return type. +```java +interface MyService { + @GET("/user") + CompletableFuture getUser(); +} +``` + + Download -------- diff --git a/retrofit-adapters/rxjava/README.md b/retrofit-adapters/rxjava/README.md index 42e1804e08c417016e814c0af52f535a8e46cab6..3352daf8f5c4547e86477536126d0a87def99c3f 100644 --- a/retrofit-adapters/rxjava/README.md +++ b/retrofit-adapters/rxjava/README.md @@ -9,6 +9,34 @@ Available types: * `Single`, `Single>`, and `Single>` where `T` is the body type. * `Completable` where response bodies are discarded. + +Usage +----- + +Add `RxJavaCallAdapterFactory` as a `Call` adapter when building your `Retrofit` instance: +```java +Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://example.com/") + .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) + .build(); +``` + +Your service methods can now use any of the above types as their return type. +```java +interface MyService { + @GET("/user") + Observable getUser(); +} +``` + +By default all reactive types execute their requests synchronously. There are multiple ways to +control the threading on which a request occurs: + + * Call `subscribeOn` on the returned reactive type with a `Scheduler` of your choice. + * Use `createAsync()` when creating the factory which will use OkHttp's internal thread pool. + * Use `createWithScheduler(Scheduler)` to supply a default subscription `Scheduler`. + + Download -------- diff --git a/retrofit-adapters/rxjava2/README.md b/retrofit-adapters/rxjava2/README.md index 67564e490da71ff59176735d9b79ef745776e84c..0512f9fbb36ce8d1d641191c8882d8d4ec7ac3a7 100644 --- a/retrofit-adapters/rxjava2/README.md +++ b/retrofit-adapters/rxjava2/README.md @@ -11,6 +11,33 @@ Available types: * `Maybe`, `Maybe>`, and `Maybe>` where `T` is the body type. * `Completable` where response bodies are discarded. + +Usage +----- + +Add `RxJava2CallAdapterFactory` as a `Call` adapter when building your `Retrofit` instance: +```java +Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://example.com/") + .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + .build(); +``` + +Your service methods can now use any of the above types as their return type. +```java +interface MyService { + @GET("/user") + Observable getUser(); +} +``` + +By default all reactive types execute their requests synchronously. There are multiple ways to +control the threading on which a request occurs: + + * Call `subscribeOn` on the returned reactive type with a `Scheduler` of your choice. + * Use `createAsync()` when creating the factory which will use OkHttp's internal thread pool. + * Use `createWithScheduler(Scheduler)` to supply a default subscription `Scheduler`. + Download --------