app/app/src/main/java/com/danilafe/fencelessgrazing/requests/DistanceTraveledRequest.kt

26 lines
941 B
Kotlin

package com.danilafe.fencelessgrazing.requests
import com.danilafe.fencelessgrazing.model.CollarDistance
import com.android.volley.Response
import com.android.volley.toolbox.StringRequest
import com.google.gson.reflect.TypeToken
/**
* A request to the `/collars/stats/distance` API endpoint. Retrieves
* a list of [CollarDistance] objects, containing, among other things, the total
* distance traveled by each animal.
*
* @param baseUrl the base URL of the API.
* @param token the API token for authentication.
* @param listener the listener that will be called if a valid list of distances is received.
* @param error the error listener for the request.
*/
class DistanceTraveledRequest(
baseUrl: String,
token : String,
listener: Response.Listener<List<CollarDistance>>,
error: Response.ErrorListener
) : AuthenticatedRequest(
baseUrl, "/collars/stats/distance", token,
listener.toGsonListener(), error
)