29 lines
1.1 KiB
Kotlin
29 lines
1.1 KiB
Kotlin
package com.danilafe.fencelessgrazing.requests
|
|
|
|
import com.android.volley.Response
|
|
import com.android.volley.toolbox.StringRequest
|
|
import com.danilafe.fencelessgrazing.model.CollarPos
|
|
import com.danilafe.fencelessgrazing.model.CollarSummary
|
|
import com.google.gson.reflect.TypeToken
|
|
|
|
/**
|
|
* A request to the `/collars/<id>/history` API endpoint. Retrieves the entire list
|
|
* of coordinates, represented as [CollarPos] objects, that the collar has transmitted.
|
|
* The coordinates are sorted by date.
|
|
*
|
|
* @param baseUrl the base URL of the API.
|
|
* @param collarId the identifier of the collar whose history is being retrieved.
|
|
* @param token the API token for authentication.
|
|
* @param listener the listener that will be called if a valid list of coordinates is received.
|
|
* @param error the error listener for the request.
|
|
*/
|
|
class CollarHistoryRequest(
|
|
baseUrl: String,
|
|
collarId: Int,
|
|
token : String,
|
|
listener: Response.Listener<List<CollarPos>>,
|
|
error: Response.ErrorListener
|
|
) : AuthenticatedRequest(
|
|
baseUrl, "/collars/$collarId/history", token,
|
|
listener.toGsonListener(), error
|
|
) |