-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Migration Guide | ||
|
||
This is a migration guide from **1.x** to **2.0.0**. | ||
|
||
|
||
## 1. Dependencies | ||
|
||
First, you should use add additional libraries to fully migrate from 1.x version. | ||
|
||
```groovy | ||
implementation("com.github.skydoves:sandwich:$version") | ||
implementation("com.github.skydoves:sandwich-retrofit:$version") | ||
implementation("com.github.skydoves:sandwich-retrofit-serialization:$version") | ||
``` | ||
|
||
## 2. AdapterFactory and Interceptor | ||
|
||
If you were using `ApiResponseCallAdapterFactory` and `EmptyBodyInterceptor`, the package name should be change like so: | ||
|
||
```diff | ||
- import com.skydoves.sandwich.adapters.ApiResponseCallAdapterFactory | ||
+ import com.skydoves.sandwich.retrofit.adapters.ApiResponseCallAdapterFactory | ||
|
||
- import com.skydoves.sandwich.interceptors.EmptyBodyInterceptor | ||
+ import com.skydoves.sandwich.retrofit.interceptors.EmptyBodyInterceptor | ||
``` | ||
|
||
## 3. Operator | ||
|
||
If you're using [Operator](operator.md), the override function should be change like the code below: | ||
|
||
```diff | ||
class TestApiResponseSuspendOperator<T>( | ||
private val onSuccess: suspend () -> Unit, | ||
private val onError: suspend () -> Unit, | ||
private val onException: suspend () -> Unit, | ||
) : ApiResponseSuspendOperator<T>() { | ||
|
||
override suspend fun onSuccess(apiResponse: ApiResponse.Success<T>) = onSuccess() | ||
|
||
- override suspend fun onError(apiResponse: ApiResponse.Failure.Error<T>) = onError() | ||
+ override suspend fun onError(apiResponse: ApiResponse.Failure.Error) = onError() | ||
|
||
- override suspend fun onException(apiResponse: ApiResponse.Failure.Exception<T>) = onException() | ||
+ override suspend fun onException(apiResponse: ApiResponse.Failure.Exception) = onException() | ||
} | ||
``` | ||
|
||
## 4. ApiResponse.error(throwable) | ||
|
||
The previous `ApiResponse.error(throwable)` function was renamed to `ApiResponse.exception(throwable)`. | ||
|
||
```diff | ||
- val apiResponse = ApiResponse.error(throwable) | ||
+ val apiResponse = ApiResponse.exception(throwable) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters