Skip to content

Commit

Permalink
Add 1.4 migration documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen authored and Maxr1998 committed Dec 6, 2022
1 parent 2bacbdc commit 3c16613
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export default defineConfig({
text: 'Migrate to v1.2',
link: '/migration/v1.2',
},
{
text: 'Migrate to v1.4',
link: '/migration/v1.4',
},
]
}
],
Expand Down
40 changes: 40 additions & 0 deletions docs/migration/v1.4.md
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.

0 comments on commit 3c16613

Please sign in to comment.