Rename the authenticated request.
This commit is contained in:
parent
e13572ae67
commit
7cd3706b7d
|
@ -7,7 +7,7 @@ import com.android.volley.toolbox.StringRequest
|
|||
* General request aimed at a protected endpoint of the API. The token can be retrieved
|
||||
* via a [LoginRequest], or, if you've made it past the login screen, via Shared Preferences.
|
||||
*
|
||||
* The [AuthenticatedRequest] expects to receive a string from the API endpoint; how this string
|
||||
* The [AuthenticatedGetRequest] expects to receive a string from the API endpoint; how this string
|
||||
* is handled is determined by the [Response.Listener] object. One may use
|
||||
* [Response.Listener.toGsonListener] to create a JSON deserializer that expects a [String].
|
||||
*
|
||||
|
@ -17,10 +17,10 @@ import com.android.volley.toolbox.StringRequest
|
|||
* @param listener the listener object called if a valid response is received.
|
||||
* @param error the error listener for the request.
|
||||
*/
|
||||
open class AuthenticatedRequest(
|
||||
open class AuthenticatedGetRequest(
|
||||
baseUrl: String,
|
||||
apiEndpoint: String,
|
||||
private val token: String,
|
||||
val token: String,
|
||||
listener: Response.Listener<String>,
|
||||
error: Response.ErrorListener
|
||||
) : StringRequest(
|
|
@ -20,7 +20,7 @@ class CollarDetailRequest(
|
|||
token : String,
|
||||
listener: Response.Listener<CollarDetails>,
|
||||
error: Response.ErrorListener
|
||||
) : AuthenticatedRequest(
|
||||
) : AuthenticatedGetRequest(
|
||||
baseUrl, "/collars/$collarId/details", token,
|
||||
listener.toGsonListener(), error
|
||||
)
|
|
@ -21,7 +21,7 @@ class CollarHistoryRequest(
|
|||
token : String,
|
||||
listener: Response.Listener<List<CollarPos>>,
|
||||
error: Response.ErrorListener
|
||||
) : AuthenticatedRequest(
|
||||
) : AuthenticatedGetRequest(
|
||||
baseUrl, "/collars/$collarId/history", token,
|
||||
listener.toGsonListener(), error
|
||||
)
|
|
@ -18,7 +18,7 @@ class CollarRequest(
|
|||
token : String,
|
||||
listener: Response.Listener<List<CollarSummary>>,
|
||||
error: Response.ErrorListener
|
||||
) : AuthenticatedRequest(
|
||||
) : AuthenticatedGetRequest(
|
||||
baseUrl, "/collars", token,
|
||||
listener.toGsonListener(), error
|
||||
)
|
|
@ -19,7 +19,7 @@ class DistanceTraveledRequest(
|
|||
token : String,
|
||||
listener: Response.Listener<List<CollarDistance>>,
|
||||
error: Response.ErrorListener
|
||||
) : AuthenticatedRequest(
|
||||
) : AuthenticatedGetRequest(
|
||||
baseUrl, "/collars/stats/distance", token,
|
||||
listener.toGsonListener(), error
|
||||
)
|
Loading…
Reference in New Issue
Block a user