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.
val nextUp by api.tvShowsApi.getNextUp(
userId = api.userId,
imageTypeLimit = 1,
limit = 10,
fields = listOf(ItemFields.DATE_CREATED),
)
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.