skydoves / sandwich

🥪 Sandwich is an adaptable and lightweight sealed API library designed for handling API responses and exceptions in Kotlin for Retrofit, Ktor, and Kotlin Multiplatform.

Home Page:https://skydoves.github.io/sandwich/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change parameter for map in ApiSuccessModelMapper

renaudmathieu opened this issue · comments

Sandwich exposes an interfaceApiSuccessModelMapper. The map parameter method should be named apiSuccessResponse instead of apiErrorResponse

package com.skydoves.sandwich

/**
 * @author skydoves (Jaewoong Eum)
 *
 * A mapper interface for mapping [ApiResponse.Success] response as a custom [V] instance model.
 *
 * @see [ApiSuccessModelMapper](https://github.com/skydoves/sandwich#apierrormodelmapper)
 */
public fun interface ApiSuccessModelMapper<T, V> {

  /**
   * maps the [ApiResponse.Success] to the [V] using the mapper.
   *
   * @param apiErrorResponse The [ApiResponse.Success] error response from the network request.
   * @return A custom [V] success response model.
   */
  public fun map(apiErrorResponse: ApiResponse.Success<T>): V
}

Describe the solution you'd like:

Rename map parameter apiErrorResponse into apiSuccessResponse.

@renaudmathieu It was fixed in #78. This fix will be included in the next release. Thank you for reporting this!