-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
1 parent
2bacbdc
commit 3c16613
Showing
2 changed files
with
44 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
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,40 @@ | ||
# Migrate to v1.4 | ||
|
||
The update from version 1.3.z to 1.4.z is easy, there are no breaking changes in this update. The release focused on | ||
performance improvements, bug fixes and the addition of request models. | ||
|
||
## Request models | ||
|
||
The biggest change in version 1.4 is the addition of request models. Previously calling the API with large requests | ||
could be annoying because all parameters had to be added to the function call. Request models solve this problem | ||
replacing the parameters with a data class to hold all values instead. | ||
|
||
Here is an example for migrating a "getNextUp" API call from a parameter function to request model. | ||
|
||
### Parameter function | ||
|
||
```kotlin | ||
val nextUp by api.tvShowsApi.getNextUp( | ||
userId = api.userId, | ||
imageTypeLimit = 1, | ||
limit = 10, | ||
fields = listOf(ItemFields.DATE_CREATED), | ||
) | ||
``` | ||
|
||
### Request model | ||
|
||
```kotlin | ||
val nextUpQuery = GetNextUpRequest( | ||
userId = api.userId, | ||
imageTypeLimit = 1, | ||
limit = 10, | ||
fields = listOf(ItemFields.DATE_CREATED), | ||
) | ||
|
||
val nextUp by api.tvShowsApi.getNextUp(nextUpQuery) | ||
``` | ||
|
||
Request models are data classes, which means the `copy()` function can be used to change values. Request models are | ||
available for all API calls that use five or more parameters. The parameter functions are still available. Both options | ||
will be supported in future versions. |