diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index b7da1c6d4..d46ec518f 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -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', + }, ] } ], diff --git a/docs/migration/v1.4.md b/docs/migration/v1.4.md new file mode 100644 index 000000000..a7377f5fd --- /dev/null +++ b/docs/migration/v1.4.md @@ -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.